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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 a1 T/ a7 i3 a4 @: K- s# X" Q! q
  1. [code]EDMA sample test application5 Q- ?1 o' i) s3 I
  2. /*
    ; a/ C/ S! D+ ?2 D1 z2 w
  3. * edma_test.c/ Y3 N: r1 P" `( f( n9 D' k
  4. *
    * s5 Q: [' z5 ]; Z, X+ {
  5. * brief  EDMA3 Test Application5 H8 h6 W# g# c" a. ^% l" U2 t
  6. *
    # g- i7 U. F: T9 P) Y
  7. *   This file contains EDMA3 Test code." K& \" \: k/ l
  8. *2 ~7 q! p& H+ i' D6 t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 \! k6 W  q. l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 ~+ k( N* b7 B9 k
  11. *         TO CHANGE.
    " h, C, ^* h$ {' H, H- k! g
  12. *
    ; j- m* r6 v* D5 s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , w9 ?- \0 S6 |1 x, W$ M
  14. *3 A& \8 ?/ n2 z2 n; p0 ?
  15. * This program is free software; you can redistribute it and/or
    ) T7 m4 Y3 A6 h5 I% X# N
  16. * modify it under the terms of the GNU General Public License as( e6 h) j: i0 q  `" ?0 \2 j
  17. * published by the Free Software Foundation version 2.
    ! T" K( E0 N4 S7 J0 G" U
  18. *% \- \, Q- d' v8 L3 L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 Y0 z2 t6 e& Y7 d
  20. * kind, whether express or implied; without even the implied warranty
    0 v+ q, q# v* _# e/ i: R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 p$ I& ]+ x! `& s
  22. * GNU General Public License for more details.* o( o; @0 ]9 O3 v, K9 ^5 b
  23. */
    5 n5 k0 _: I9 }

  24. $ z( h9 I2 o( N. t4 M: P0 N$ N1 O
  25. #include <linux/module.h>
    4 m5 x5 P! b" [2 G* X: x3 K
  26. #include <linux/init.h>: O7 {6 J; n5 m6 ^7 [. p  p( ]+ g
  27. #include <linux/errno.h>4 w/ b: w" F! }( G
  28. #include <linux/types.h>/ E% Y6 @% j" f- S
  29. #include <linux/interrupt.h>
    ! c* T1 [# }" k% |$ N/ Q
  30. #include <asm/io.h>( u. |& `3 W5 N6 j8 h
  31. #include <linux/moduleparam.h>3 g9 y/ l7 M4 h; g3 Q( Q$ O8 X" ~( @
  32. #include <linux/sysctl.h>( m. \  D2 n( H7 P# ?: `" Q
  33. #include <linux/mm.h>
    ( ]* B" ^4 S+ `, ~: G. N$ @
  34. #include <linux/dma-mapping.h>
    ' u) h6 }4 t- O/ }; j* P

  35. ' p* y2 O% i8 Z% Q
  36. #include <mach/memory.h>
    - C* h7 C& F# Y  M$ a- Y
  37. #include <mach/hardware.h>
    3 t' e! Z& n  T
  38. #include <mach/irqs.h>
    1 D  g6 f" ?: i6 ^9 V
  39. #include <asm/hardware/edma.h>
    7 G6 I* j9 x% |+ ~7 z
  40. 6 `3 g# ]+ p) J' R4 F* Q1 a1 ^
  41. #undef EDMA3_DEBUG3 r6 H5 o0 F7 i' _& X
  42. /*#define EDMA3_DEBUG*/
    5 _- h5 k# y5 X$ d1 Z6 @& m# \
  43. - y& }) F7 M9 ]" p6 v9 `% V& t
  44. #ifdef EDMA3_DEBUG
    % d, ?4 @, ^* N9 T% N$ `- e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' q' W+ V5 L  Q& R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : y2 w, H' @- J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      ]: J$ {. h! L  ?( \/ e
  48. #else* |* y$ ~2 t' `9 |
  49. #define DMA_PRINTK( x... )
    * |& [9 E2 ]# U( X
  50. #define DMA_FN_IN
    7 B5 G% i# d, s' F
  51. #define DMA_FN_OUT# Z/ B1 ^% V! w. z3 q5 m" G
  52. #endif2 Y' |% A! m7 s+ r. j

  53. 0 j# S) b1 s) \* T8 U9 r- h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : {2 x" P4 M; a% B! G4 u' r
  55. #define STATIC_SHIFT                3
      ^; Y9 b; i( m" r6 l
  56. #define TCINTEN_SHIFT               20
      [: a' A% Z+ X- s/ M
  57. #define ITCINTEN_SHIFT              21( B' n) T- U0 D( f
  58. #define TCCHEN_SHIFT                224 {8 d6 @, b1 v1 N4 x
  59. #define ITCCHEN_SHIFT               23' N8 [4 g$ Z6 e  p5 a

  60. : H7 m1 S! S) a5 O4 I% Y/ U
  61. static volatile int irqraised1 = 0;9 U, `. ]( x  f, ^
  62. static volatile int irqraised2 = 0;: |3 r0 V0 [, N+ w- F6 ?, Z
  63. ) U# o1 `# o+ J. N1 F, j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 w5 `# i3 C$ d& z% l2 q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 a: b- Z/ E1 [4 s* ?; b7 }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % K/ Q; m4 E, \. O

  67. . `/ ~/ |: z  f! D1 k$ m
  68. dma_addr_t dmaphyssrc1 = 0;
    4 O& `: F1 {; j, s: A
  69. dma_addr_t dmaphyssrc2 = 0;
    8 {" M- L. m6 H  g4 M! z
  70. dma_addr_t dmaphysdest1 = 0;
    ' e, D0 P2 X6 s. Z7 V! [
  71. dma_addr_t dmaphysdest2 = 0;2 {% r7 w' _# Z7 Q2 \
  72. , g6 r4 U3 L4 `* ?8 h/ _, m% ~' {; J
  73. char *dmabufsrc1 = NULL;
    - X3 |6 x  m3 \- e
  74. char *dmabufsrc2 = NULL;  N8 {1 w: L8 A4 ?8 M, @5 ]8 B, t* {
  75. char *dmabufdest1 = NULL;
    7 W, b% H: z) T3 D$ H0 T
  76. char *dmabufdest2 = NULL;
    , e! d* ^( D' _( X: y2 E/ q
  77. & d/ d/ [7 Q% H- W: _1 S+ X3 ~
  78. static int acnt = 512;
    " D" w7 X0 m9 \- |
  79. static int bcnt = 8;6 h: m* q6 b$ y$ Q) H! n$ n6 e
  80. static int ccnt = 8;
    ; d8 v5 @" n' D' t. Y4 G/ d
  81. ! b! T1 p/ m0 k' `
  82. module_param(acnt, int, S_IRUGO);
    - }- E8 z3 Z; G4 G( {5 o% p" `
  83. module_param(bcnt, int, S_IRUGO);
    & i4 a: ]( v, p( M2 k/ P1 h
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 b8 x4 m8 F2 u3 t( `' ?
# x( f2 }9 U( x5 l# R      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; V- x7 G. j2 c* R8 V  b% P9 ]! {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: k- w6 e: l- k6 c% e$ G  r
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% b) Z$ Q& q) g6 [( x4 l  r' E# ?7 k! u3 l1 i( u" x; P8 i3 G

, z7 w8 d3 @; G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-13 14:42 , Processed in 0.038493 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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