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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 i+ Z* B4 M4 V% R8 G/ d
  1. [code]EDMA sample test application5 M0 U2 ]1 }) g5 z
  2. /*
    / t5 I7 S) j' _/ f, W( [
  3. * edma_test.c
    " E9 O( [, Z  ]9 h& ^
  4. *
    % H/ l$ s! _$ R( Y& H
  5. * brief  EDMA3 Test Application
    * }9 X6 H/ x0 I! e* [
  6. *9 T- Z' [/ q2 F) m! ~
  7. *   This file contains EDMA3 Test code.
    # G+ Q; I' j! b) @6 N* H# o
  8. *) I' a8 ^9 }8 p# D0 q' }: L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 _; s0 r; K6 R; i% ^/ U  f  ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: I. L8 X2 h1 c7 ~1 M, K; k5 F( j
  11. *         TO CHANGE.
    8 K4 w* M' I, Q7 J
  12. *
    , P. p* e9 k4 G' r: ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( ?, A1 c* E$ A/ O, j0 C  h
  14. *( q9 _% s/ z9 s/ S/ k
  15. * This program is free software; you can redistribute it and/or2 F* ~" b- Z% z2 W
  16. * modify it under the terms of the GNU General Public License as
    1 X0 s* a6 H9 H9 p2 }6 K
  17. * published by the Free Software Foundation version 2.. Z( i* F3 S7 \$ W2 ?4 M$ \
  18. *0 u9 A& G" \( p' C3 W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, I" Y# p5 j( d. E5 }
  20. * kind, whether express or implied; without even the implied warranty+ l" J6 f/ i! R) c' [4 ?  t2 T3 B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 P" g1 f0 }6 @3 Q
  22. * GNU General Public License for more details.2 i  S% L0 Z* [! p: y
  23. */
    3 u2 T( e; d( }. j2 [

  24. ( B8 V* U& a/ c4 y5 A4 @
  25. #include <linux/module.h>
    5 J( t# [+ t0 E, Y% {
  26. #include <linux/init.h>
    1 Q6 O' h: O  P; ]7 s0 y5 z  ]
  27. #include <linux/errno.h>
    3 \4 V& d# ?4 |3 e! b6 z; u) l
  28. #include <linux/types.h>+ c2 b3 Z# Q9 F) S( S+ {, M
  29. #include <linux/interrupt.h>/ W, b; ^. z3 S
  30. #include <asm/io.h>5 d' K! F7 L( {3 u; S) M4 f& _
  31. #include <linux/moduleparam.h># U5 y4 g8 G4 ^, o
  32. #include <linux/sysctl.h>
    ! D, M- m7 N; }6 w. r. g; s
  33. #include <linux/mm.h>
    3 `# T5 [9 z/ E1 I7 x
  34. #include <linux/dma-mapping.h>
    6 |- P+ @+ x2 F
  35. 5 N0 k/ |6 ~) k
  36. #include <mach/memory.h>
    4 k* ?: V; r) f, O- n( \
  37. #include <mach/hardware.h>8 X5 q" o2 R5 {; x
  38. #include <mach/irqs.h>9 u( k  S  i  V
  39. #include <asm/hardware/edma.h>8 d+ d2 x* g* z( {* y- d
  40. : |: o3 q3 J$ K3 w6 Y& k8 H0 ^
  41. #undef EDMA3_DEBUG/ _' N9 }# i% t% I9 y' R: _% e
  42. /*#define EDMA3_DEBUG*/
    5 b4 p) I# P7 `  B! x

  43. " K% r: w( W% T$ u0 Q
  44. #ifdef EDMA3_DEBUG
    : D# r/ C  W0 @2 S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- r) I: d% ~+ R" T+ W) Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " ], g1 Q" g4 ?- ]4 m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . `$ ?; D- s3 q/ U  A" R  D4 R
  48. #else* ^/ A$ h% v) A- j3 A
  49. #define DMA_PRINTK( x... )
    , b9 S+ {1 U7 V3 K
  50. #define DMA_FN_IN
    0 @& N- B" d! i2 `! Q6 k- a
  51. #define DMA_FN_OUT1 O, D. G4 V+ a' A6 u  H
  52. #endif
    5 X4 O7 b; u3 Z/ l- B

  53. / a6 d) {3 |8 t" c) h3 M9 t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : O" W1 g$ u8 D0 r  @
  55. #define STATIC_SHIFT                3
    0 N6 `: o& r; U. C& E
  56. #define TCINTEN_SHIFT               20
    7 P  b, H7 c. l4 j9 L" I/ u
  57. #define ITCINTEN_SHIFT              21
    3 N8 T0 O: u% B" ]( r7 c
  58. #define TCCHEN_SHIFT                22* c4 n: H! ^5 d# r
  59. #define ITCCHEN_SHIFT               233 E& K' c; L# o  V; ^" _# M
  60. - @1 y9 N% r% |
  61. static volatile int irqraised1 = 0;
    9 k) r( H* D+ U$ n+ w
  62. static volatile int irqraised2 = 0;9 `" \8 N' s, J

  63. ! E# L/ {( D/ W1 U$ o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & e, w  b0 w4 f; l, ~5 {; w7 G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ y4 X8 z6 I  O- `  i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & c, t2 @( h' {$ ?
  67. 7 h. k0 _, O! w. ^, L# Y
  68. dma_addr_t dmaphyssrc1 = 0;
    0 G# R- }; Z) g: V$ w' ~; ^! R
  69. dma_addr_t dmaphyssrc2 = 0;1 Z% X; {' P* H- i$ T
  70. dma_addr_t dmaphysdest1 = 0;
    . v* i$ |. G: M* }0 ~" ?
  71. dma_addr_t dmaphysdest2 = 0;8 c4 T0 W+ z' [( z

  72. ' a' D% M' X: C
  73. char *dmabufsrc1 = NULL;% Z7 J- w9 {. z0 f
  74. char *dmabufsrc2 = NULL;% v1 O8 ^9 s+ H! t
  75. char *dmabufdest1 = NULL;1 z- a& F) L0 u% N/ I0 H: T+ x4 z
  76. char *dmabufdest2 = NULL;
    % k: Z: w$ c+ K! m& P

  77. 0 }& ?7 l% e" K) t
  78. static int acnt = 512;
    " J6 C  o0 F! s" ]
  79. static int bcnt = 8;/ I2 s, {# R- ?0 V+ i
  80. static int ccnt = 8;
    ; Q5 |7 B2 D1 k7 |
  81. ! s1 H9 U  K  L$ ?9 F; C
  82. module_param(acnt, int, S_IRUGO);
      J' w  l) m3 z0 V6 w- E' K8 e/ S
  83. module_param(bcnt, int, S_IRUGO);6 ^& x7 a* b* Q2 m6 k- }
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 n2 n& T6 i8 T* G: B+ Z  [0 C' F
4 U1 r4 F. ~9 d7 n, h9 N( u
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 c3 S5 x& b. r& ?" M
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- D5 b- p3 C5 y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  c7 z' f, k# N  G+ [

# E; {6 v' O  ^/ _
. H* Z9 S) t3 l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-8 20:33 , Processed in 0.038313 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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