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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 C. F2 _! C1 ^7 c9 ?& {9 V
  1. [code]EDMA sample test application
    ; m% H3 M( f# F+ S; x9 @
  2. /*3 U% h+ J5 s; ~1 q; j2 o7 g
  3. * edma_test.c
    ' w4 I; g& x" |/ U4 v" w0 j
  4. *
    9 s) r- ?4 Q! c- _# h/ O% i
  5. * brief  EDMA3 Test Application  t3 ?' ]+ z; R+ w+ M# L5 h
  6. *
    2 M2 n: \/ L2 [! }& _/ S3 [3 N: _
  7. *   This file contains EDMA3 Test code.
    + v, x/ {* D( _$ p/ X
  8. *$ M  i* G9 }0 s9 ~+ f. n9 e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 n. J. A& R0 |8 R2 w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      d; U; ~2 y7 \& U
  11. *         TO CHANGE.
    6 h( O$ _8 V* u
  12. *: i1 f' k' P( q$ U. ~1 h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* h! u. I5 ]8 Q' z
  14. *
    & q* F. |0 _( @7 F9 `. R
  15. * This program is free software; you can redistribute it and/or2 M/ j3 \- ~' _( z$ h
  16. * modify it under the terms of the GNU General Public License as
    - |7 c' ~7 s/ \/ M3 e5 E
  17. * published by the Free Software Foundation version 2.3 G: E$ S+ X. f5 n  Y
  18. *
    1 W$ K, U; G# N  F# ^3 n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % U( F# L% @% ?/ {& {/ G, [1 p0 o
  20. * kind, whether express or implied; without even the implied warranty
    ( H# Z" \& q9 ?1 n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 a6 o+ c# G! k5 ^
  22. * GNU General Public License for more details.
    9 Z% G1 E. ?1 e% Q* S, M! V2 N
  23. */
    6 E  @6 {  |" y* ?, G; S

  24. ! D& M) ~; V' l+ f# s, }
  25. #include <linux/module.h># E# Q; G) S: b3 L  l+ p( I
  26. #include <linux/init.h>4 z' b. t- o4 h
  27. #include <linux/errno.h>
    # ^, O  g3 s" w( `7 g+ L8 y
  28. #include <linux/types.h>
      r$ k) V6 R- C% h- P2 b5 v# N: Q4 |
  29. #include <linux/interrupt.h>5 c" b  I( ]/ n. R* H
  30. #include <asm/io.h>
      F( r8 O/ U3 H+ g
  31. #include <linux/moduleparam.h>' M. D$ L1 D3 l4 c7 t% U5 }3 @7 b/ i
  32. #include <linux/sysctl.h>
    7 G# v. A4 \7 u, J: D
  33. #include <linux/mm.h>
    * H, t# h: ^! ?8 Z5 B
  34. #include <linux/dma-mapping.h>
    2 Q. |  v6 c7 H5 G1 a5 {# `& _

  35. 1 Q& g  x9 a" z
  36. #include <mach/memory.h>
    ! K' _/ b7 L! ?+ u
  37. #include <mach/hardware.h>% [/ n4 S$ P# q! ?
  38. #include <mach/irqs.h>4 W3 b! {8 y% \1 a5 b# S3 |, {  u
  39. #include <asm/hardware/edma.h>9 R5 n9 U4 {+ F4 }
  40. 9 {+ q- _6 ^: `: g& e2 A
  41. #undef EDMA3_DEBUG
    ' ^( O$ k: r' c. n: ^
  42. /*#define EDMA3_DEBUG*/
    ) m- K8 Y+ G; n' p* w
  43. , W) {  H' F, A  G( G2 K
  44. #ifdef EDMA3_DEBUG6 U, p- c$ w3 p  a: Y# X; s$ q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" s5 M4 C( ~, _3 Q, F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * _4 T+ M. A) }1 ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! b* ?& `) q# h! y/ R4 T
  48. #else6 ^5 {* k: Z& q5 ]. x4 h
  49. #define DMA_PRINTK( x... )
    9 H3 h) l2 K# ^" y* J
  50. #define DMA_FN_IN
    . M$ m0 b' n5 O. b% e6 v
  51. #define DMA_FN_OUT* q: I( g3 r  U. R7 D
  52. #endif7 c$ ~9 P. k1 h( h# i
  53. + O1 G( p7 r% Y7 l  l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 N" }/ y7 M. u8 p5 f0 |
  55. #define STATIC_SHIFT                3. s8 E' y' Q" p9 B
  56. #define TCINTEN_SHIFT               20
    0 t- j( o. \. e9 F0 G, Y
  57. #define ITCINTEN_SHIFT              21
    - t% C' r# u1 ]+ C
  58. #define TCCHEN_SHIFT                22
    4 [& k. D8 l! _- e4 M7 c
  59. #define ITCCHEN_SHIFT               23
    : m: L8 h: W0 f6 O0 v0 y
  60. 6 P% \* `% s, @; N9 f
  61. static volatile int irqraised1 = 0;0 c2 B1 T- E+ A8 L4 ]3 P5 y5 q. L
  62. static volatile int irqraised2 = 0;
    4 T$ X+ J# b$ v

  63. 2 [! `! w. k) A4 w$ c" ^. c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * B* d' [6 W& E* J& d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 p3 y# v$ f$ K+ N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. `0 |: ^$ R& H* W9 C5 M4 y$ r

  67. * k  u* h* e6 X3 s$ B: u# _: X
  68. dma_addr_t dmaphyssrc1 = 0;
    . A; |1 A( }2 l& ]- G9 o% Z, j
  69. dma_addr_t dmaphyssrc2 = 0;( P+ N) h& U. v" F3 h& D
  70. dma_addr_t dmaphysdest1 = 0;
    7 t7 [; T* ^8 O  X0 [
  71. dma_addr_t dmaphysdest2 = 0;: g' [0 `% V' Q/ @4 I
  72. 4 O4 i/ @( I- L, @* W
  73. char *dmabufsrc1 = NULL;8 J( \4 e+ u! S( i7 T! O
  74. char *dmabufsrc2 = NULL;5 Q! W7 w, w: l/ L1 V3 H3 b
  75. char *dmabufdest1 = NULL;
    8 G6 i4 l% W( X5 u9 P* \
  76. char *dmabufdest2 = NULL;* d6 @; y; W5 Z1 W) F' G
  77. ( C$ J4 K& |  H5 U5 w5 _" A
  78. static int acnt = 512;* t' U  a4 A, u4 f) i1 m4 ~# J
  79. static int bcnt = 8;
    - u3 S) k& i  o: _. ]
  80. static int ccnt = 8;2 y% M( E; ^& [

  81. : i: h' y2 t0 k
  82. module_param(acnt, int, S_IRUGO);0 j3 S8 e5 W4 R6 k$ s) a, |
  83. module_param(bcnt, int, S_IRUGO);. V. j1 H( f1 [; n4 r4 n3 O
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! M4 g# G, ^# A& L$ m
: t- r6 Z- ~6 G4 h
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# E5 ]" u: R2 Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 @7 X" {5 ~' E( U1 ]) m
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& T/ \+ y% a" Y

$ X# T' ]7 ?0 J% n6 t: @" v8 [4 w" J1 L% B% R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-1 00:00 , Processed in 0.061625 second(s), 33 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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