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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * m8 J* O- P5 Y0 p+ t, N
  1. [code]EDMA sample test application( v4 ~. _+ l! X# l! U2 ^& n
  2. /*- w5 j. x" p& Q% q7 K
  3. * edma_test.c$ o8 ]* x. e" e
  4. *
    ( }" ]5 `" t; B. ^
  5. * brief  EDMA3 Test Application; h" C4 B: M, X" I! W! r+ J5 s
  6. *
    % q7 u3 ]1 a4 ~0 Z
  7. *   This file contains EDMA3 Test code.
    ! e; q4 @9 L) ]" D! ?
  8. *; j; z0 A! [. J9 t( s1 `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 |8 ~+ t& e& R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ R+ N5 r; T* j7 V* i( X
  11. *         TO CHANGE.9 E9 A5 x/ n( i& g8 {0 _% t$ l# |
  12. *' e7 o/ k  n, A# x5 U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 g- ?+ V- ^* h2 w  m9 D
  14. *
    - C" m7 ~0 f9 g- u5 _
  15. * This program is free software; you can redistribute it and/or+ A8 y6 H1 g; }: \
  16. * modify it under the terms of the GNU General Public License as, J2 I; e3 s+ _' {: X
  17. * published by the Free Software Foundation version 2.
    # a2 q4 d6 L  H$ f$ i
  18. *1 b) H. q2 M# w% d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& Q" n2 e' Y6 L% Z9 S4 Z4 |
  20. * kind, whether express or implied; without even the implied warranty- o  U( l; H8 T4 I7 d- K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 D! d) {, C2 A  T3 Z2 B
  22. * GNU General Public License for more details.
    ' m* M8 @5 f, Z5 ~$ l7 g
  23. */5 v+ w7 `- k/ f- A5 e: O( I2 @
  24. , v6 p( V) L% \- m1 D
  25. #include <linux/module.h>3 M0 ^9 f" o* q3 Q" @: {; i  P
  26. #include <linux/init.h>/ w) T& n. `+ G4 p" n
  27. #include <linux/errno.h>3 C2 ~! L: ^* S% @  Z# s' _2 }
  28. #include <linux/types.h>" U2 B$ N+ x1 ~( U1 }
  29. #include <linux/interrupt.h>8 X. c- Z$ B& b) U, m' W$ m! q
  30. #include <asm/io.h>
    " g7 D- u& c8 r5 o/ K% A6 M
  31. #include <linux/moduleparam.h>4 S) L" c; x8 u# _$ T, c
  32. #include <linux/sysctl.h>
    : R/ \# Z% O+ n' j# r% L, s
  33. #include <linux/mm.h>7 `0 G. O0 V. x
  34. #include <linux/dma-mapping.h>
    - G/ A% j" y/ v! b9 p$ R

  35. 5 @9 P% D9 U) P1 t7 o* P
  36. #include <mach/memory.h>
    3 Y/ i/ k3 j% `2 z; j  V" @: X
  37. #include <mach/hardware.h>
    9 P% f/ c7 ?' M( E, u/ z$ W" q! I
  38. #include <mach/irqs.h>
      ]0 W% q  g. u9 y" B( D
  39. #include <asm/hardware/edma.h>
    7 Q- x1 O3 T5 \1 `
  40. # u1 g. `! O' W7 c$ O; N, Q8 ^
  41. #undef EDMA3_DEBUG
    + z; G2 j/ T' I; Y1 |
  42. /*#define EDMA3_DEBUG*/" S/ _  M2 t$ T& C

  43. 4 P3 V. @7 \/ e5 R
  44. #ifdef EDMA3_DEBUG
    9 ~; s) }& F0 h0 b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # Y# [4 e8 E! V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ T+ H3 k% k7 {+ f0 S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / I5 t# Q7 E+ t9 G" B3 J9 _
  48. #else* @9 ]  Z7 ^0 t: W: y
  49. #define DMA_PRINTK( x... )
    * L% j2 B6 A1 j/ r; M
  50. #define DMA_FN_IN4 T; K2 c" T7 C3 m& T' _
  51. #define DMA_FN_OUT
    3 b0 Q# C8 W* v( ?  n8 H0 _  R" J
  52. #endif
    1 [# j+ ?3 i9 j: [) _: S
  53. 0 u; n0 U4 }8 }0 I) M+ D7 N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : v! y9 a5 e& b8 M
  55. #define STATIC_SHIFT                3
    9 d0 u. `3 I  q3 C) |9 T* ]$ s
  56. #define TCINTEN_SHIFT               20' s0 H8 z& H7 m7 v, s7 @5 d
  57. #define ITCINTEN_SHIFT              21( O* ?) M4 ~# Y. x5 R
  58. #define TCCHEN_SHIFT                22) a, C# D% }$ L3 p3 `5 P
  59. #define ITCCHEN_SHIFT               23
    ( E; \; n, f1 |  V8 _. s) g
  60. 6 T* Y8 X+ `0 O8 v" h& w$ t- s
  61. static volatile int irqraised1 = 0;6 E) T: u! a# V( j! G* G
  62. static volatile int irqraised2 = 0;( j8 I% ?+ g* D
  63. 8 |, Q3 ?7 I! |3 J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * Z2 P( @1 j6 v- w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" G  h2 M+ p4 `" s" {) w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- }3 l7 j8 O/ O

  67. ' E" i( C5 F# x5 {
  68. dma_addr_t dmaphyssrc1 = 0;% _! q4 p* `  K9 m0 T( K
  69. dma_addr_t dmaphyssrc2 = 0;
    0 e" ]& Y$ _: a" a: s
  70. dma_addr_t dmaphysdest1 = 0;
      A; A; h4 |7 p: U; z0 ^' ?
  71. dma_addr_t dmaphysdest2 = 0;3 X! B- E! l* m$ d' n) v

  72. 7 N2 B/ G. e% n7 t+ C
  73. char *dmabufsrc1 = NULL;
    3 {1 [: K" i6 t% U1 {. b
  74. char *dmabufsrc2 = NULL;$ j/ ?% h: T/ L7 P7 _1 E4 N1 u
  75. char *dmabufdest1 = NULL;* S1 ~$ I  |* r5 ]
  76. char *dmabufdest2 = NULL;! Z" i: O4 c: l! s, p
  77. * {: I6 a1 S# t. I% C4 d
  78. static int acnt = 512;4 @- U+ O( d7 P4 B0 g. `
  79. static int bcnt = 8;
    3 n: m4 P1 h5 \/ @) j) U# _' }
  80. static int ccnt = 8;
    8 l! i- P0 I* F

  81. ! L* h: G2 O9 Y) l* `
  82. module_param(acnt, int, S_IRUGO);
    ! {/ D, M3 j# N0 a7 D
  83. module_param(bcnt, int, S_IRUGO);9 {* l3 C- _4 S/ Q7 m  {( s
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 u$ R5 c1 i. r) e5 j/ }
1 ?9 D  F( X0 k7 Q9 B
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 t+ F0 f! s# d$ U9 \9 varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 @6 H7 x0 }0 j$ ~
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' t  {7 U# ^2 O/ _) ~, r

4 b: _! {$ i2 L8 m5 y
3 m( k$ _4 H, @& ?: ^" `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-19 05:22 , Processed in 0.038203 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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