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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) ]; a* h9 b. @0 d
  1. [code]EDMA sample test application
    % u+ ]1 {! l/ y; n
  2. /*
    - K7 [8 k. E0 ?+ Q1 u
  3. * edma_test.c
    ) [$ b. C. s. ~  z
  4. *
    2 r, r7 C0 Z& _" M7 H
  5. * brief  EDMA3 Test Application
    ) }! \* s7 |3 @3 K. S
  6. *# {$ u# q+ F* \% r" h
  7. *   This file contains EDMA3 Test code.; d# k+ e" S: n  J" x4 N
  8. *5 {3 }8 v( k, P4 O% K: `/ C2 q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' ?5 `- }, N/ d3 K$ G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      @0 f2 @* a7 e
  11. *         TO CHANGE.
    5 U9 ^( Y0 Q) G+ C- r4 m
  12. *
    3 A$ T5 w' @1 `6 D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! o, l  u' N' d
  14. *
    * e% X. S+ e. {$ j
  15. * This program is free software; you can redistribute it and/or" _/ d7 l6 f! Z& ^
  16. * modify it under the terms of the GNU General Public License as2 ^) y; a9 m' V. t- L1 }
  17. * published by the Free Software Foundation version 2.8 W/ \' `  l4 n4 q
  18. *
    2 x" H8 G; Q6 P" [4 S1 V# z# |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! l8 f" {1 _* \' F! a
  20. * kind, whether express or implied; without even the implied warranty
    : C% j: y7 r( b& K, F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 I5 X: f' b/ h' N
  22. * GNU General Public License for more details.# U. s/ {6 }1 v% D( ~8 B3 c
  23. */
    ) F9 ^/ z! Z! t) M

  24. 3 U- t7 k' k- D& r" g
  25. #include <linux/module.h>
    7 j9 O- [! z" B/ G% j$ k
  26. #include <linux/init.h>
    8 H9 L+ X1 Q5 o8 _7 x
  27. #include <linux/errno.h>
    ) ]+ A4 g2 m( U! o* w
  28. #include <linux/types.h>
    7 U4 N2 v* H+ u7 C* n& m: X3 l7 _
  29. #include <linux/interrupt.h>  J$ j0 x* t; ~( ?! d% Z
  30. #include <asm/io.h>: d* j1 L. g- O! ^, ^7 N5 ^
  31. #include <linux/moduleparam.h>8 f& H5 u# U3 C
  32. #include <linux/sysctl.h>
    ( q4 i/ C$ a  ]  q
  33. #include <linux/mm.h>
    / S4 t4 k- O7 f1 O' a- j
  34. #include <linux/dma-mapping.h>
    ! ]+ T* r  g. k# I) L0 t
  35. 9 e; E6 o( |( w/ ^5 W9 D$ t
  36. #include <mach/memory.h>- r: a+ ]1 n7 ]3 q3 l
  37. #include <mach/hardware.h>+ i* ~5 D0 T) [9 [& L, W
  38. #include <mach/irqs.h>1 I: a+ G9 n2 t+ g  p; f2 ^% U
  39. #include <asm/hardware/edma.h>
    % E  B2 G, P! Q- m5 P0 _. Z

  40. & Q+ n! A5 L) X4 R" I; j) x
  41. #undef EDMA3_DEBUG3 B( D# T* E6 c5 U0 C; K' @
  42. /*#define EDMA3_DEBUG*/
    ( ]: Q. D# `' l" c( |
  43. + P, @; E2 M' C7 S0 k. B: |
  44. #ifdef EDMA3_DEBUG
    - G: H# ~- y! r' F2 {# ~/ H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 J5 u7 G7 ]; X/ M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " q% W: g5 f/ _) I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 n+ @$ Q/ u1 L8 }( R+ P3 q& ]+ A
  48. #else
    * Y  ^+ H$ c+ [7 a' v
  49. #define DMA_PRINTK( x... )) [" h) [/ u3 F, j/ _2 ^* _
  50. #define DMA_FN_IN
    ) K$ ~# x" j( b3 V
  51. #define DMA_FN_OUT$ _9 x+ Y, J% [/ Z: G
  52. #endif  \5 J$ F: H7 j! [  V- H

  53. 9 _) K5 ^' G1 o" o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 Y' Z. t; S9 P; \$ p6 c
  55. #define STATIC_SHIFT                3
    $ a* ^6 D  p( }2 Z$ E7 Q$ |
  56. #define TCINTEN_SHIFT               20
    / L' o- |8 m: a/ H- y
  57. #define ITCINTEN_SHIFT              21
    : H( r6 b9 N# T% u3 c1 E
  58. #define TCCHEN_SHIFT                22
    ; e  w0 r/ S: n9 d" W
  59. #define ITCCHEN_SHIFT               237 i' I" ?4 x% F% J& h" V0 i) ?  X
  60. ; x8 V! Y. [( r. k) w" J
  61. static volatile int irqraised1 = 0;6 s+ a! @# _7 Y% T- ^% j
  62. static volatile int irqraised2 = 0;2 l- y) p/ D' ?; N- w3 V& n1 H
  63. . W5 |  x& i, Y0 e+ f0 j% ]% Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ N6 p" `: u+ a" c, H7 f4 v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * h7 W! J- {' V6 t3 E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ z4 i: Z/ j& H
  67. ! ]- G: \' B& _7 a
  68. dma_addr_t dmaphyssrc1 = 0;) L7 a9 A! Z' B: ]  p
  69. dma_addr_t dmaphyssrc2 = 0;* N/ o# \- B: X* x$ a* }. A* H
  70. dma_addr_t dmaphysdest1 = 0;
    ; t% ?) z$ g9 E% P6 E1 `* {
  71. dma_addr_t dmaphysdest2 = 0;
    * _$ V1 j7 h' n- s9 s) D1 m; p4 f
  72. 6 Z( R" y2 S6 H: M# c' [5 I# N
  73. char *dmabufsrc1 = NULL;5 U  U$ H( `& R6 w  l
  74. char *dmabufsrc2 = NULL;/ p' {1 S- V" |$ Y/ m
  75. char *dmabufdest1 = NULL;
    " L: G+ b) [8 q! H4 d# ~* X
  76. char *dmabufdest2 = NULL;
    & z( y+ {2 A5 t5 T( R

  77. ' y* M1 I' C, ^. l
  78. static int acnt = 512;
    , a' r. c* a+ n; [
  79. static int bcnt = 8;" m& K9 d2 w7 l2 m3 o. K4 P
  80. static int ccnt = 8;" x- Q. X! p7 @1 V6 I. N5 {4 _+ l3 i
  81. ( x4 g- O1 n9 a( h9 y
  82. module_param(acnt, int, S_IRUGO);5 H+ N- L+ d1 o) }
  83. module_param(bcnt, int, S_IRUGO);* S: G6 a" i& g  i5 |7 |$ u
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 E; O- y  |  O4 ]
; p! H% c! `. S      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 j4 v& J# @: o& |" W3 H$ z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) X8 K( k5 {; e1 g* e
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 J, v" Y. }) p% S4 Z) H' X2 }, g% ]) b+ \$ W

& f. m" ?1 H2 ?4 P$ b( x; o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-10 08:12 , Processed in 0.040597 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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