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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 i( G+ x8 }% u" j/ f
  1. [code]EDMA sample test application
    & N, A6 z9 Y/ @
  2. /*2 d7 I* h: G! C  S
  3. * edma_test.c
    : I. J; \7 @9 p7 j
  4. *- p% k* s  `0 V: @' r( z$ P. H5 v- k
  5. * brief  EDMA3 Test Application% R8 p, x8 ?0 i2 N) |  d' Y
  6. *7 R$ S' P7 i7 G& B
  7. *   This file contains EDMA3 Test code.
    3 |. Q: f! T9 {9 U$ x8 v3 u
  8. *& u0 d: J) b/ [3 s+ P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - F1 E' M$ X2 J4 h3 `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 J. r- \+ j' u$ }2 R# l3 v" p4 l8 D
  11. *         TO CHANGE.9 Q( H& Q3 v0 Y+ I) o1 v
  12. *
    1 a- B& y3 }* X( t' U% w# T  i7 _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; {# j+ g9 a$ l" f3 W8 N7 m9 V% S
  14. *
    3 d. A. p8 o6 j( F$ V; s: {
  15. * This program is free software; you can redistribute it and/or
    6 U, B3 |) V3 V. O" z# w  y; W0 O
  16. * modify it under the terms of the GNU General Public License as
    / M/ s- @5 l6 o4 n) t6 \
  17. * published by the Free Software Foundation version 2.) T& ]( f# p4 i- O9 O
  18. *
    $ C! g" h- A: L2 G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' C% s; W! u/ g5 J- W+ B
  20. * kind, whether express or implied; without even the implied warranty
    " K$ X4 o$ `8 y* f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . |# a- o8 h0 O) o) L% s
  22. * GNU General Public License for more details.. ~6 g3 z, i5 u4 ~5 X0 X8 v
  23. */+ a/ E# R" ^+ {$ @9 `7 X. q

  24.   [* r3 b) _' D8 K' N9 V8 G* l
  25. #include <linux/module.h>: x5 v2 ?9 \& q
  26. #include <linux/init.h>9 D* L0 z5 z! X" B
  27. #include <linux/errno.h>9 j( E: r" V  f
  28. #include <linux/types.h>
    " G- E9 G$ a0 A, C; b' H
  29. #include <linux/interrupt.h>) k* W' R! `$ w
  30. #include <asm/io.h>! }: ~; `! `6 l. F2 V
  31. #include <linux/moduleparam.h>
    1 l! m9 x" ]) x# T
  32. #include <linux/sysctl.h>$ W9 K2 ]7 m. C7 M8 E7 i
  33. #include <linux/mm.h>( N3 g" ^+ i& _: f$ e  F0 Y) Z
  34. #include <linux/dma-mapping.h>
    / y! x1 B% F6 ^. D# N2 s6 Q1 j6 v4 N

  35. ( _, x/ T( E/ C$ s# m
  36. #include <mach/memory.h>* D+ ^+ c; [6 c* l5 i. p. |
  37. #include <mach/hardware.h>
    4 p% B3 W: o5 ]( j- }
  38. #include <mach/irqs.h>$ \4 E% v1 p7 C4 M1 `, U
  39. #include <asm/hardware/edma.h>+ P& E8 C0 m, f$ d% y* ]4 k

  40. % l: e0 a; C: ~3 C( b, ]. Z2 K* P
  41. #undef EDMA3_DEBUG6 n% h* h5 I4 |7 G
  42. /*#define EDMA3_DEBUG*/
    - L: _: [, v$ g  }" _
  43. + Z( x( r' Q2 T
  44. #ifdef EDMA3_DEBUG. d! {  c: Z3 {0 w" R+ c% p$ m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; d( `" f: `, y5 z0 h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , @" r% l3 U6 n; L7 ]6 O2 s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! g1 |, t( e6 P- R+ d
  48. #else! c" l8 G2 F) t; j! l& X3 M) Y
  49. #define DMA_PRINTK( x... )
    - B  _* N, I, E5 ^  X8 G# ?8 S* ~
  50. #define DMA_FN_IN5 j/ _" P1 `' X. g" y' f( \
  51. #define DMA_FN_OUT! y6 l! K  J; J! e4 G4 T
  52. #endif
    ) F0 B9 B3 q' Q8 c/ s

  53. 9 s9 o7 H7 P/ P$ E5 U! P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % `* ]- K) t( h1 _2 J- F( \4 M+ f
  55. #define STATIC_SHIFT                3
    ; |1 F, S5 Q! B7 g5 {
  56. #define TCINTEN_SHIFT               202 }- m) `) b: g3 L, e: w% v
  57. #define ITCINTEN_SHIFT              21: |& `, |7 ?+ V, O* H
  58. #define TCCHEN_SHIFT                22% T+ x( G# [% u
  59. #define ITCCHEN_SHIFT               23
    . M% G* g% s" D. w: m" p2 N

  60. ' g% g- p6 a, O$ M2 d. e3 ~
  61. static volatile int irqraised1 = 0;
    2 J# h! r# e+ e" |& B
  62. static volatile int irqraised2 = 0;( e! k  }! ~& z/ V) |: N1 ]) E3 h
  63. * G: V5 v$ Q- K# x- j0 O, r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 l7 K6 ?9 m, X$ H. E# g' m- q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( j1 s: `, ?9 }+ R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- h: H2 |3 U: r( M4 I* V" m
  67. " i* h; L! f  U5 a' }0 J
  68. dma_addr_t dmaphyssrc1 = 0;
    5 |# [/ y! Q" N. l% t9 s
  69. dma_addr_t dmaphyssrc2 = 0;
    2 D6 J; I5 q: F* y
  70. dma_addr_t dmaphysdest1 = 0;
    8 V; X8 f* S2 ~/ G: L9 J
  71. dma_addr_t dmaphysdest2 = 0;
    ) ]6 L  b% H, m
  72. 0 s$ W) H# N9 r: Y7 a9 N
  73. char *dmabufsrc1 = NULL;  ^; e7 T: y% E
  74. char *dmabufsrc2 = NULL;
    ) `. }9 R, k& {! k' B2 ]% D! C
  75. char *dmabufdest1 = NULL;( v. \; u  X0 S' D
  76. char *dmabufdest2 = NULL;1 s: x* w! O6 J5 v" g" L

  77. , E1 k# s& A* r- o
  78. static int acnt = 512;
    4 B5 Y: e; u0 X
  79. static int bcnt = 8;
      i/ J9 G" L+ b
  80. static int ccnt = 8;
    7 K" c( U. b  q1 S
  81.   g# _, W" {+ y1 V' _: L4 `
  82. module_param(acnt, int, S_IRUGO);" W, u, K, I6 u1 o" a' i
  83. module_param(bcnt, int, S_IRUGO);2 o2 H, G: _. b2 ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 i  S4 f" B( U2 \" }" s! \' Z3 H' h7 ?- h# W1 [
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; I  r. F# ?/ t% W$ Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  {/ [6 M3 R* Z2 U5 Y6 X
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 m* \  H* [$ L$ [6 _) W1 U/ v
+ D3 Q8 W) C: _+ S3 B( n

. b* E- w6 I& f' }5 G) @2 N: I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-23 20:45 , Processed in 0.038695 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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