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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 S) |1 e; h: f# M) m9 Y4 M
  1. [code]EDMA sample test application
    6 f7 q& @# U( M( `2 h
  2. /*
    $ x0 [1 t/ [8 ^" H
  3. * edma_test.c
    : X/ H6 l5 a; f: y
  4. *; e  }9 x; w$ ?$ m' g4 b
  5. * brief  EDMA3 Test Application
    5 H/ f; r- v' H5 W
  6. *0 o* ]4 y- I. P6 s0 U7 b
  7. *   This file contains EDMA3 Test code.- w% b7 A2 S9 X
  8. *
    # Z8 X2 l, P( }! t  b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : R2 i' n0 k' ~9 C* b, T" q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " k; a) K0 y4 S; Y
  11. *         TO CHANGE.
    , o9 K3 w6 }* O; U! l8 r
  12. *
      l" V( b. m/ [! Q, }8 C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 i: \8 b" i; w5 i3 \. I2 t
  14. *
    0 k( K; m9 K9 m% V/ n. S
  15. * This program is free software; you can redistribute it and/or# x6 v% f+ q& K. ~
  16. * modify it under the terms of the GNU General Public License as
    1 m" O2 y! Z: }+ Z$ H* @5 b
  17. * published by the Free Software Foundation version 2.9 l$ k. t" a$ a: B4 k
  18. *
    ) [* j0 k" g; ^; m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 u& T& \( b% l7 K% g/ B7 p, p- D
  20. * kind, whether express or implied; without even the implied warranty! q- f, z2 k9 Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# A1 c, F3 \  ~7 a. A: w
  22. * GNU General Public License for more details.
    5 }- N5 N* D6 g* e
  23. */
    . }2 b/ V- _( n3 ^' f
  24.   D' c- E. G0 O4 B8 t1 m; M
  25. #include <linux/module.h>
    % W: |( C3 n. u
  26. #include <linux/init.h># Q2 w8 w8 N; g9 [9 c$ k
  27. #include <linux/errno.h>
    6 k7 E4 E2 j# q9 R
  28. #include <linux/types.h>
    1 Q0 p+ K( m  m, Z" `
  29. #include <linux/interrupt.h>" ^  W% S! d# {' N! o+ t
  30. #include <asm/io.h>
    9 K4 _4 `% x% m; ?8 l
  31. #include <linux/moduleparam.h>
    ) t6 Z% u8 v7 q8 M+ l
  32. #include <linux/sysctl.h>5 m- p+ c" B# B1 w- i
  33. #include <linux/mm.h>3 _& a6 |/ s+ ^+ D( N
  34. #include <linux/dma-mapping.h>: q1 q5 R: o( ?; d: C
  35. 6 J( X2 K/ X$ f5 H; P) s  O* E
  36. #include <mach/memory.h>( c- e& f# q0 k
  37. #include <mach/hardware.h>
    ; \7 _8 N3 I! J; s% c
  38. #include <mach/irqs.h>8 x- C. s  M, d/ I
  39. #include <asm/hardware/edma.h>
    ! t/ a+ U' h  z2 Z1 L+ n( d% S

  40. 1 k2 I+ i% z0 w  W8 Y' i; B8 _* I
  41. #undef EDMA3_DEBUG& \: b6 S) Z% c; |8 D
  42. /*#define EDMA3_DEBUG*/) q2 _, f1 G. C* y  H

  43. 9 N6 [) I' ^) v
  44. #ifdef EDMA3_DEBUG2 n/ D  k% H1 A: S) Z. J2 ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' a* E- O) y9 l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 i# ^% I5 K0 {" Z, i9 t. b( u+ Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 U0 v8 t$ ^! r- ?
  48. #else2 P, I! j# @) B; A  N$ X$ o
  49. #define DMA_PRINTK( x... )
    * T* j3 S& m6 b
  50. #define DMA_FN_IN
    0 Q/ y$ p1 d5 Z* a
  51. #define DMA_FN_OUT
    ( R+ i7 M' S1 q; ]
  52. #endif
    4 y6 p3 l+ e$ V4 h, n$ K6 d
  53. $ F4 p/ `1 f0 E0 s+ x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' g- u! T6 D5 I% j6 J
  55. #define STATIC_SHIFT                3
    + F  g% R' \* F: d. M) ^
  56. #define TCINTEN_SHIFT               20
    9 X5 [4 x2 }! M, q1 q
  57. #define ITCINTEN_SHIFT              21
    , c0 X" p, s6 d2 A: \" e
  58. #define TCCHEN_SHIFT                22! Y" i1 c- h" V3 b9 ]" ~. \
  59. #define ITCCHEN_SHIFT               23
    , ^4 }  N$ R" b; O- p. ?* [

  60. + ^4 w) k/ _( E, V- A
  61. static volatile int irqraised1 = 0;
    6 O/ f" `# a1 K$ }
  62. static volatile int irqraised2 = 0;
    1 w' Z; e6 ?# r& d
  63. 5 A2 `$ ]- ^* L6 E0 m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ m- P2 h- V! }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: w( l4 p7 t: D+ e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 s# }$ f, g  `% p
  67. 6 I) E) \& t4 W' U! c6 I
  68. dma_addr_t dmaphyssrc1 = 0;; s0 u6 J3 [, f
  69. dma_addr_t dmaphyssrc2 = 0;
      L) a% f3 n4 q. L/ V
  70. dma_addr_t dmaphysdest1 = 0;) @  }0 e, n0 y$ H
  71. dma_addr_t dmaphysdest2 = 0;* |5 v. I/ X+ o- l" \3 c
  72.   x( O5 v0 A, B2 \  Y4 }( i
  73. char *dmabufsrc1 = NULL;% N! U7 k% o2 }7 b' H! q/ q
  74. char *dmabufsrc2 = NULL;# C' ]; `6 b* P: ]  f7 N/ D
  75. char *dmabufdest1 = NULL;8 ~" E, ]4 a% Z( X! j2 h
  76. char *dmabufdest2 = NULL;6 q; a1 E" [0 Q! {+ Y6 C# N
  77. ! r5 E! j! p2 ^+ v( s6 I# K
  78. static int acnt = 512;
    4 q0 g- n' o3 v" v- \
  79. static int bcnt = 8;2 {% J, J$ K' ]1 a7 R9 Q
  80. static int ccnt = 8;: H* s" s( ~6 B4 S; ~8 }- Q
  81. & h6 o5 p" L5 d! p' O# P/ w% m
  82. module_param(acnt, int, S_IRUGO);
    # w0 c. [2 Y+ `& Z2 h- ]) Z
  83. module_param(bcnt, int, S_IRUGO);1 J; F) I  |( ]/ n- V
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& H8 e3 Q* [9 W; g! U1 b4 A

. e' Y- P; u' C* W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 N' g7 s/ I1 q, Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ m1 O5 J  S8 [( [% X) |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) V% e2 c6 w9 k, Q$ d& [
! {3 G. }6 o7 K3 U! {7 B* J

" ^2 w9 i  t8 ~7 O$ ^+ {; T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-23 18:58 , Processed in 0.043270 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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