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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# T2 `4 r% o+ [% z: B3 y/ R
  1. [code]EDMA sample test application
    - k% W. V' Z" m7 A' V5 D/ T
  2. /*+ ~% [9 t( c' w' Z% `% g
  3. * edma_test.c
    $ F2 F- q) L: Z1 r
  4. *  n, c, ^: a! @' i+ `' h
  5. * brief  EDMA3 Test Application
    # t* J! z- D$ l" H9 C: _$ G9 D% u
  6. *) L0 P- g  U, d5 _8 m7 ?8 C7 k
  7. *   This file contains EDMA3 Test code.
    " b9 [. x( c! k; N) I, B  d" a
  8. *
    1 O  W4 ?5 l) X' g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 |" l; O8 K6 v0 i6 R% V  T6 M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- H; {  b( f2 D7 u. N0 B) E
  11. *         TO CHANGE.
    0 \5 k+ w7 D9 Y  J) Y) P8 K" N! h1 S
  12. *5 I$ Y. f$ b- {$ p' \. ~# e1 a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 u3 C& q6 k7 N6 i5 C
  14. *9 a5 ]" v1 i1 R/ J4 u; q0 o
  15. * This program is free software; you can redistribute it and/or
    ; U* N0 F' d- _' G7 J3 e0 W. z
  16. * modify it under the terms of the GNU General Public License as
    " m4 F& Y6 B8 Y& i! z
  17. * published by the Free Software Foundation version 2.
    4 T' L( U+ P% f9 K8 P
  18. *
    1 Z( S" |- |) d( T5 Y2 f2 T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* _! n6 Q7 r7 ]: }" r) B4 q+ E
  20. * kind, whether express or implied; without even the implied warranty' r/ N+ A4 T/ u3 H) @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ Z! r9 H$ X# @) u
  22. * GNU General Public License for more details.- X1 C' Z$ M/ y9 ]& b
  23. */! }0 P. x$ P8 u9 T6 r4 Y' K6 H
  24. ; v: `6 q# d/ N$ r( a( ?
  25. #include <linux/module.h>
      `1 _3 `% r* }+ W
  26. #include <linux/init.h>
    ( m3 J& _2 d/ K( r7 ]- \+ a
  27. #include <linux/errno.h>
    $ N% S( m9 |/ i3 a7 Y2 a
  28. #include <linux/types.h>
    2 p! @$ I) x9 n( p8 @
  29. #include <linux/interrupt.h>
    4 d# D- _: s0 c  W# g* y% X
  30. #include <asm/io.h>
    . N  |/ N1 P, C' _. _0 B, J( R
  31. #include <linux/moduleparam.h>
    ! {; `9 {+ G' J; \
  32. #include <linux/sysctl.h>
    ) `" T( |0 f6 s4 f: o1 \% j6 s) m
  33. #include <linux/mm.h>
      L9 }$ J3 Y7 j
  34. #include <linux/dma-mapping.h>
    4 L) H* ^6 C$ q' ?7 h
  35. 2 ^7 o* L  |! ]: E
  36. #include <mach/memory.h>
    , e7 z; V0 M# ]5 z
  37. #include <mach/hardware.h># \. E* _" L9 Q5 Q
  38. #include <mach/irqs.h>$ F4 P: {$ ?% N
  39. #include <asm/hardware/edma.h>
    ( i9 I2 O# g# t

  40. 9 H" ]. Y+ u& ?
  41. #undef EDMA3_DEBUG
    ) d9 H  Y# N( M  P
  42. /*#define EDMA3_DEBUG*/: K$ S% P. B/ k4 H& A2 ?4 \* U! S
  43. 5 ~! M) f7 v6 \+ ]! ~+ O+ `
  44. #ifdef EDMA3_DEBUG# D0 _" r7 y$ a( F$ ^( i7 k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - c+ J3 N5 O: [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% s1 U* q' U; t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " [# S$ `, w- _+ ~7 y- q
  48. #else! X( S* s; G% u
  49. #define DMA_PRINTK( x... )' @* w5 V* f7 m7 \! o1 b+ e$ b4 L
  50. #define DMA_FN_IN
    # r% Z( \+ q; M, K5 M
  51. #define DMA_FN_OUT
    8 \/ n* g+ u) _0 D8 h
  52. #endif
    8 x0 v0 T3 t' W: L! D
  53. ! @% B- N  l* ^! p3 O* D0 A7 N) N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 @' T. @5 G3 U) h% u/ A
  55. #define STATIC_SHIFT                3
    & ^1 v  ]; b$ w; h$ _. X
  56. #define TCINTEN_SHIFT               20
    % q, Y% p6 b1 a
  57. #define ITCINTEN_SHIFT              21) m0 j. I. d7 n
  58. #define TCCHEN_SHIFT                22
    % [$ E6 I5 h$ R- k6 R3 L
  59. #define ITCCHEN_SHIFT               23& d7 ^8 J" w! c$ E* A

  60. 7 w) H# I$ h0 X6 Z1 R2 W( A. @
  61. static volatile int irqraised1 = 0;3 E2 O& o+ R- q4 h8 n1 b  L
  62. static volatile int irqraised2 = 0;
    ! r+ O" q' r$ c

  63. " s" c3 R4 d9 n" z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 G% R3 P0 h# L* P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' y& L' f, h$ {4 B, d5 P- ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ A) x( [$ h: T2 D, m$ a0 Q

  67. - ^0 i5 ]/ p; f# B1 [& D
  68. dma_addr_t dmaphyssrc1 = 0;
    # D7 V) Y2 i- D/ b
  69. dma_addr_t dmaphyssrc2 = 0;
    ( ]' \- L3 A% `5 B) o: O; a% o3 r) ]
  70. dma_addr_t dmaphysdest1 = 0;& {) ^2 P+ r. u: q, b
  71. dma_addr_t dmaphysdest2 = 0;3 A* i% d. {3 W8 ]
  72. ; y: a) B! @) H
  73. char *dmabufsrc1 = NULL;
    4 O  g& ?' q  g- r$ N  r
  74. char *dmabufsrc2 = NULL;
    " s1 T8 p& K$ _/ e
  75. char *dmabufdest1 = NULL;. D; g; |4 [4 c) H
  76. char *dmabufdest2 = NULL;
    2 B: ]( T: k0 O

  77. - y2 P9 a# g; p. r8 Y9 B" ^
  78. static int acnt = 512;
    ! W7 c, @2 o# T1 X# S& j4 N
  79. static int bcnt = 8;
    . X" I2 I5 x. Q; E4 N. z8 l: x9 W
  80. static int ccnt = 8;, P7 I+ W% u0 e1 i/ l7 c% h

  81. : f& U; G( ?, S5 A
  82. module_param(acnt, int, S_IRUGO);' H3 H8 y4 C' `) G& A" b
  83. module_param(bcnt, int, S_IRUGO);5 \- O; v5 W1 p! g; y# n7 C
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  c9 w4 K1 K* p' P8 Q6 i

% g$ n' _5 B. Y8 f; W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 p( s+ b2 c9 {# Y0 B9 P8 X1 g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* X) E  J+ x, ?" h/ o8 X
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 Q5 L$ C% C: @5 f9 p. G9 P6 w' t9 |' `% R! J) u# j) Z2 X* r5 A
7 i% m' l, N6 X# Y- _! R4 p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-2 17:33 , Processed in 0.041856 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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