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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  Z" |! Z0 K8 B) W5 q" q; M
  1. [code]EDMA sample test application2 q$ ^# V5 q3 P* [+ ^
  2. /*
    4 {' @( D3 y, z( L; [
  3. * edma_test.c
    " d. T" x) _" ~5 o/ y! i6 }6 u* |7 i
  4. *- f4 \6 q& ?; s$ @. v
  5. * brief  EDMA3 Test Application
    3 ^5 O5 e: M8 G
  6. *8 o4 }/ T: {  F% P7 d+ m
  7. *   This file contains EDMA3 Test code.
    2 M" X. y- K9 G5 t9 e' K5 O
  8. *
    : \  ]7 _0 _* g: I( c9 m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 N* q8 `4 @+ W% g+ h6 u8 H: a) l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' c  r/ t) u9 p8 m
  11. *         TO CHANGE.
    # Y0 ^5 Z' Y% R% @' ^$ ~
  12. *+ E- L( g0 r. }& Q) ?+ l" I$ C: h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 s9 j+ B) H! Z# d& L+ v/ ^$ S
  14. *$ \& n8 P: U- n
  15. * This program is free software; you can redistribute it and/or7 H5 x/ k8 N. P& d
  16. * modify it under the terms of the GNU General Public License as* r* B% h. ^$ S
  17. * published by the Free Software Foundation version 2.9 R/ ~2 W1 S3 y- z9 v  F
  18. *
    3 ^# O  Y& X. ~5 W- R5 B% U: Q# X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! H- A* a9 N" d4 ^% A( _1 e# `
  20. * kind, whether express or implied; without even the implied warranty) a' W! S6 K- Z; ]$ |; ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! d+ O- L9 T# X; {- D- R9 ^6 V6 ~( X
  22. * GNU General Public License for more details.
    / f0 C5 e  }3 }5 @7 K/ Y& N
  23. */% c' q$ e! T" x

  24. 1 O$ S8 B- E$ H- M3 i) a
  25. #include <linux/module.h>1 s7 p3 y3 l1 R% k
  26. #include <linux/init.h>
    & Q7 P8 V1 P, g! B1 ^2 F
  27. #include <linux/errno.h>4 ^% n9 P7 q( a
  28. #include <linux/types.h># c# H# D+ ]- i" u9 S
  29. #include <linux/interrupt.h>
    % d) R" ~( {! N1 {2 X4 d
  30. #include <asm/io.h>
    . K3 b) l; Z, ^1 E5 Z/ Z
  31. #include <linux/moduleparam.h>
      L$ i, j0 H  v" @+ n) V0 K. f4 W
  32. #include <linux/sysctl.h>
    - ]- n/ s5 [. I" l  {! n, n5 x
  33. #include <linux/mm.h>
    % r6 {( `# d! [# Z" M" d
  34. #include <linux/dma-mapping.h>
    9 p6 c  {7 z0 M- n; q  f

  35. ' {, B& z4 ]5 k8 K. K/ T- u
  36. #include <mach/memory.h>
    ! R( V) G. A& \+ Z  D+ m* {
  37. #include <mach/hardware.h>
    ) S( ]) Q* N0 T) k' H; r) W$ E
  38. #include <mach/irqs.h>
    3 z7 R# c4 u( b: B# ~
  39. #include <asm/hardware/edma.h>, P' j4 w/ t2 c, |
  40.   X. q: g: Z, R8 y
  41. #undef EDMA3_DEBUG4 D/ m2 Y% o/ N9 Y& G" y
  42. /*#define EDMA3_DEBUG*/
    9 B& h! D+ S, v' \! i. ~

  43. " i9 Z$ `# G$ Z! P
  44. #ifdef EDMA3_DEBUG4 ]1 g. S6 q9 Y# y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ D: R' V# z( l! E3 L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 a5 L0 S1 x, l/ Q% K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 [) d2 U* p4 j8 d0 B- _
  48. #else4 b  W' S0 h  R. u0 j
  49. #define DMA_PRINTK( x... )' M- q& |  K. E* o4 o
  50. #define DMA_FN_IN; s6 I& r& d4 A/ r
  51. #define DMA_FN_OUT
    ' m$ S: U+ E+ y' @9 l" k
  52. #endif/ [/ g; G" c6 a& P, X

  53. 9 W' u3 E3 \# K+ Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & _1 S3 w& R/ r- k
  55. #define STATIC_SHIFT                3
      k9 G3 y- p& n+ m, H
  56. #define TCINTEN_SHIFT               20
    . l# W1 A, A& L7 \. R
  57. #define ITCINTEN_SHIFT              21
    ) Q8 p! _; T" F# K+ {% B5 ^0 T
  58. #define TCCHEN_SHIFT                22
    3 t$ j0 \+ C& }% q- o- S
  59. #define ITCCHEN_SHIFT               230 v+ v; ^; ?2 f) H
  60. 4 Z& v+ e- Q0 ^6 y
  61. static volatile int irqraised1 = 0;
    ( ^5 q) F- L" I& T$ D
  62. static volatile int irqraised2 = 0;
    * _  x1 N( B: \( Z( F

  63. ( j9 H0 X5 G" a" c! D) e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( ^& {9 u* O  Q4 z( }+ `( U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . j! T' V, m; A( [% N+ f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 n& N2 M* x# o6 i* [

  67. 4 m4 A$ Z( G2 U& H' V
  68. dma_addr_t dmaphyssrc1 = 0;
    8 T; Q6 s$ h* z. Y9 |/ w
  69. dma_addr_t dmaphyssrc2 = 0;3 e" L0 f2 k; O! s3 e
  70. dma_addr_t dmaphysdest1 = 0;
    $ N: ~9 Z, i; J% G8 J& A$ \* G. g
  71. dma_addr_t dmaphysdest2 = 0;7 ^2 h& s( A5 \
  72. : J, v$ D# I+ ^- H
  73. char *dmabufsrc1 = NULL;- L* A6 |) ]. @: S' M0 C" @
  74. char *dmabufsrc2 = NULL;
    % @' @- G; p. J$ q, G" j$ q. R
  75. char *dmabufdest1 = NULL;
    - ]8 M$ k5 g$ B8 X7 o1 g
  76. char *dmabufdest2 = NULL;
    ! o& |& Y7 s4 k+ r' K8 _

  77. * ^4 M  ?4 v  m# G
  78. static int acnt = 512;
    6 r6 |. P: f. `/ y) `2 v
  79. static int bcnt = 8;
    , M  L6 e& n% I. t. B+ c
  80. static int ccnt = 8;$ D# k9 q+ {% o% E

  81. % [' |: t' d% X& e/ A. m: L
  82. module_param(acnt, int, S_IRUGO);  o( N$ R: a% s6 }( {. {0 Q3 D
  83. module_param(bcnt, int, S_IRUGO);
    1 D& u# Z- F) X7 N; L, s8 {
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& l7 M7 g3 W( O; X* g, Y: b6 t0 R' d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' y! e+ y. }; [  I6 D. iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# L' U( R  F! @# ]     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ v6 I9 Y4 c$ E( s6 c4 L& T8 e

5 v2 [- b* {6 B4 h, _3 @7 l# X" D5 q8 ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-3 19:57 , Processed in 0.045121 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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