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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- U6 ?9 Z; j& w4 Z& q
  1. [code]EDMA sample test application& Y) T/ j7 l  L/ X1 n! t
  2. /*
    $ h5 S+ l. e) X* U( u! \) M* U2 }# Q
  3. * edma_test.c
    ) _: X4 \) Y; s5 v7 n% O
  4. *. O6 ?, L& M$ [6 c
  5. * brief  EDMA3 Test Application
      h( R1 M) I4 u( h1 h
  6. *( O3 @: L6 N  k* A% X6 m
  7. *   This file contains EDMA3 Test code.
    0 S9 @0 F2 F* u1 x/ W1 f( ~
  8. *7 {' d5 ]+ V! [* ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 G( ?$ }  j! I) E* l/ M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 W6 _. g0 k% f$ ~) w
  11. *         TO CHANGE.& Z( f1 S+ e  w+ r: |6 L
  12. *. l+ @; ~8 V* c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' }& x* F* ^' X. X+ J, v& d$ N
  14. *  v& R( b+ P& B. p5 K  D& X
  15. * This program is free software; you can redistribute it and/or6 A; p7 j) i7 @) d) _
  16. * modify it under the terms of the GNU General Public License as
    * u" n! n; c, ]4 x
  17. * published by the Free Software Foundation version 2.
    # F9 t2 r: p7 \4 @9 R# I
  18. *# ?* a9 I9 t+ l: E+ B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 l6 U% r' n9 a% r0 {1 [
  20. * kind, whether express or implied; without even the implied warranty5 X) m6 i6 |5 s7 f8 J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 O' U& Q5 l% `+ N, D
  22. * GNU General Public License for more details.
    ' f& V# h( D3 f6 q; `
  23. */" ]( v% k4 q. E( t2 v

  24. 5 w. i5 g& G/ t, F, R& }
  25. #include <linux/module.h>( F6 X, m! z6 Q5 n/ n1 Y- w
  26. #include <linux/init.h>
    " d, u0 C; z! ^$ W9 V/ y
  27. #include <linux/errno.h>! X. ]* T0 L, A# G3 O
  28. #include <linux/types.h>
    4 W, q4 }& x# J$ h0 `3 S% g
  29. #include <linux/interrupt.h>
    1 l* Q' i3 u- B% L& s5 K
  30. #include <asm/io.h>1 R) G, w1 X* ?/ G
  31. #include <linux/moduleparam.h>
    ' H* y1 I+ e  b. Y
  32. #include <linux/sysctl.h>
    " J5 z# c" g2 P. D
  33. #include <linux/mm.h>
    / p+ d- S6 V, ^+ I' b2 s0 i
  34. #include <linux/dma-mapping.h>
    ) T5 K/ r2 n' W

  35. , u/ w7 _1 a4 m5 G
  36. #include <mach/memory.h>- y* ?3 k6 W3 j0 Y; o7 Z4 g; y& v
  37. #include <mach/hardware.h>
    % F, W: U4 `1 N( P
  38. #include <mach/irqs.h>! h# H8 h1 z! K3 {
  39. #include <asm/hardware/edma.h>& G* }4 s6 y- L" G
  40. ( C! c: B! P7 R; o
  41. #undef EDMA3_DEBUG
    % Z' p3 k. e+ n2 f
  42. /*#define EDMA3_DEBUG*/8 f( S* [8 Y6 t5 c% H

  43. , P) H2 \4 ~0 @; F( x3 f
  44. #ifdef EDMA3_DEBUG9 \- b# j. P% l2 T8 |3 Y9 m7 e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( v2 F) o4 V' Q1 {/ B- w0 F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 D8 ?: l4 e8 R. t% a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 E5 B" O. U" m( b& |
  48. #else
    : I  i, L" q; r* v# ]( ~
  49. #define DMA_PRINTK( x... )
    : K6 T$ a2 j7 @8 m7 w. {
  50. #define DMA_FN_IN" S9 R$ K% l+ ^) W5 f2 D
  51. #define DMA_FN_OUT! y8 \8 T9 y4 t. o% ^
  52. #endif
    7 q. W( w: K- Z' h( j- l$ K6 s- n
  53. & \& ~  R% z  c/ H8 ^( o  q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 L( X, b5 g5 P8 u/ k: s
  55. #define STATIC_SHIFT                3: N; z. a6 U( c& \; J
  56. #define TCINTEN_SHIFT               20
    3 ?  g2 J  ^1 V0 _" ~. t
  57. #define ITCINTEN_SHIFT              21
    2 o9 A. H: ]; u4 }* ]. M! l! ?
  58. #define TCCHEN_SHIFT                22
    3 I$ I( H! |0 I  M: u6 R
  59. #define ITCCHEN_SHIFT               23
    4 ~* P" T$ [5 e- u9 q
  60. ; V+ f% X  i3 C
  61. static volatile int irqraised1 = 0;0 R6 f/ }# E+ i5 b% G; g) V% _
  62. static volatile int irqraised2 = 0;
    # m5 S8 j- T+ Z

  63. ) g1 {9 p& ^( ?0 r8 V- P; f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 v, J" c2 e2 i2 @! Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 a/ Q) k; L; N7 T! v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % Q$ X& m9 u" t/ C; I, z

  67. 6 F* z4 B  c1 h* ]7 J$ h+ E0 V
  68. dma_addr_t dmaphyssrc1 = 0;4 C; ^* G, e6 D3 P
  69. dma_addr_t dmaphyssrc2 = 0;
    ' ^0 A6 H: i: _7 h- ]) Y* E
  70. dma_addr_t dmaphysdest1 = 0;
    / i9 V/ @' d/ j6 t9 E# d7 C1 P
  71. dma_addr_t dmaphysdest2 = 0;! s6 U- r0 a4 v# @

  72. ; T5 `3 [: G" v3 h
  73. char *dmabufsrc1 = NULL;+ o' L) k4 k) M) L* Y0 k8 o
  74. char *dmabufsrc2 = NULL;- v* P: q, [  D; N
  75. char *dmabufdest1 = NULL;
      J+ ^2 \. }3 s8 j' F( [7 q0 \
  76. char *dmabufdest2 = NULL;
    7 R, F) e' u( y6 [
  77. ! T- x8 [1 U1 y6 `7 ~1 ~
  78. static int acnt = 512;
    9 R- W. X/ u; Y9 A$ |7 i
  79. static int bcnt = 8;, E2 I7 j6 S3 d9 C6 U( \
  80. static int ccnt = 8;3 q% ^* t6 W( b0 E8 f3 n

  81. ! w' H+ V7 ]1 t1 {  v: E8 }" x
  82. module_param(acnt, int, S_IRUGO);; q3 k* G* O6 ?/ G9 x* u( U2 j1 g
  83. module_param(bcnt, int, S_IRUGO);
    7 F# t5 D- T  f  G& f+ ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- p+ j5 j$ a, i7 D! \& O
& e; n4 l) {2 f8 X( d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' ~6 @4 J: X( v# Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 X/ }: e+ v: O: {) w4 G( K1 {% b: V     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 h: C+ B' A8 ]5 u

% Z* e4 j3 V6 \9 `; M  I' {* A' x/ l4 Q8 J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-31 09:33 , Processed in 0.040108 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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