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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  U( z- `: Q1 y% k3 @& K
  1. [code]EDMA sample test application
    9 j$ N" o) L- I# p( b3 Z
  2. /*
    " w# q- p$ O+ U0 D( M
  3. * edma_test.c$ o0 J# U5 ~: @9 g9 g
  4. *
    1 O& Y( I7 @9 {& A/ [' T2 {; Q
  5. * brief  EDMA3 Test Application! b; ?& T2 A  _$ b0 l* O1 W0 h
  6. *1 c1 ^; v, z0 ?! p& ~" n! B% y
  7. *   This file contains EDMA3 Test code.
    5 }& \5 \+ {$ u
  8. *
    ( a: R8 P. \* ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * h7 w5 r2 K: i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# Q. ?9 {# f# [, }
  11. *         TO CHANGE.
    4 o0 T/ @2 P- u( l) B9 T1 w
  12. *7 d1 @. \6 R! I( f3 V2 F8 M4 ]& O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 D- Y7 V# ?0 c! r
  14. *
    , _0 y( X' e2 }1 ?7 l. i
  15. * This program is free software; you can redistribute it and/or
    + _& w/ P: e2 N" m
  16. * modify it under the terms of the GNU General Public License as
    # R+ R  V+ |0 B% n& ?7 V3 k
  17. * published by the Free Software Foundation version 2.3 P/ M: P+ S+ y5 a9 I
  18. *
    9 ^% G: @6 J/ B6 B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # Q0 i6 G( {4 [- c; n
  20. * kind, whether express or implied; without even the implied warranty4 q3 g, K, u- h6 ^1 d; y& a5 m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! A5 I% F' g- X$ U: Z8 T  C
  22. * GNU General Public License for more details.
    & e# |$ J. a. l; L- h
  23. */
    # B7 q* d+ f$ [9 f" v9 S; ~
  24. + Q) a. W2 r/ g& e. L, N& x
  25. #include <linux/module.h>
    3 V4 ~! w  B, ]/ \
  26. #include <linux/init.h>
      R8 j- g  y- J# x) `. ~
  27. #include <linux/errno.h>* k  U% u, ?) j: K+ E0 R
  28. #include <linux/types.h>0 T- R% p7 F  G* N9 j5 K
  29. #include <linux/interrupt.h>5 O" s' {: N$ x5 M! _+ C
  30. #include <asm/io.h>7 s! H2 j1 B% \1 T: Q
  31. #include <linux/moduleparam.h>
    , Y1 Y" W: n) m$ V- X: ^) h# x
  32. #include <linux/sysctl.h>
    . d; C: i, J' y; S: D- Y
  33. #include <linux/mm.h>3 a. q$ Y* [5 V1 ], ^4 j; X
  34. #include <linux/dma-mapping.h>, O* M9 C! b0 |; [  d" Q
  35. * P: o5 v2 F9 ^7 o# W
  36. #include <mach/memory.h>  b% Q3 k' t* X5 E
  37. #include <mach/hardware.h>! P; G: s7 f% U1 m4 O0 }
  38. #include <mach/irqs.h># j3 O) q; |& n; _% l  J- I
  39. #include <asm/hardware/edma.h>
    ! Y* t" F( q) K0 ?0 f' U
  40. % ]) X0 Z. g9 V. _( I) T
  41. #undef EDMA3_DEBUG. E; ~  P. \1 M  r3 d) n! i9 H1 e
  42. /*#define EDMA3_DEBUG*/! V6 V* u1 V& K5 p2 B, z$ k
  43.   S0 s4 d& ^; M
  44. #ifdef EDMA3_DEBUG
    " ~% R( G& k# I5 E' @3 s: K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 y7 |1 _- E3 Y: b5 D6 r( s4 n" v8 R4 G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ H' G+ [0 b( K1 h4 |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 _5 v* W9 Z" s& r1 U
  48. #else# Q! ]. d2 u0 ]; z
  49. #define DMA_PRINTK( x... )
    # L7 r0 s' W0 @0 ~' m
  50. #define DMA_FN_IN2 b( H. D5 `, ^
  51. #define DMA_FN_OUT4 ~) s7 z2 {8 T; m+ g
  52. #endif
    " S5 {* }; m6 p% [  g5 q# _! F9 i
  53. # V/ B( T  `0 a$ G- i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' O. W  e# Z% b9 x/ S
  55. #define STATIC_SHIFT                39 S; ^: W4 B; v' a- [7 ^
  56. #define TCINTEN_SHIFT               201 n  k6 y1 }+ l) C
  57. #define ITCINTEN_SHIFT              21
    - v3 w; ^. G( c, U. n, _& s; s
  58. #define TCCHEN_SHIFT                223 c- ~% a; k6 p* J# O
  59. #define ITCCHEN_SHIFT               239 c0 Q( ]/ v6 O) {

  60. + l) {( c1 h! k! b2 Z
  61. static volatile int irqraised1 = 0;
      l1 F0 e* T9 v3 i+ Q
  62. static volatile int irqraised2 = 0;
    " F/ J+ O2 I; [. i  Y9 Y% Q
  63. ; ]5 y# [! i6 x4 E$ L. r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 P) i7 |: ?2 @0 A, r% Y. }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 x1 S2 q* X! m4 L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 N( P9 l. X" B. h/ q
  67. $ o  Q  Q3 c3 y
  68. dma_addr_t dmaphyssrc1 = 0;/ z+ z0 v, P& q7 P
  69. dma_addr_t dmaphyssrc2 = 0;% ]- Z& H# l8 L) y! O! \  t
  70. dma_addr_t dmaphysdest1 = 0;
    % H7 _4 f; t' `5 @1 J
  71. dma_addr_t dmaphysdest2 = 0;
    # r6 n! i% u& f

  72. / `5 N" P+ _4 S$ E7 ^; @" ?! C
  73. char *dmabufsrc1 = NULL;$ B5 ]: r1 b; Y
  74. char *dmabufsrc2 = NULL;. F! m% I0 m% p9 F  j3 j$ l* X
  75. char *dmabufdest1 = NULL;
    6 A( L) @9 f# S8 N8 L
  76. char *dmabufdest2 = NULL;
    ( O7 f2 i! L" ^' I3 n
  77. ' Z* ?5 Q9 ]2 ]* r: `% D
  78. static int acnt = 512;: i6 J# i0 d7 D. P
  79. static int bcnt = 8;
    1 B4 }, J$ i+ \( G7 T
  80. static int ccnt = 8;
    1 ^8 o  ]- e- Q  E3 ]; C0 N

  81. & @. \6 d, M9 ?) ^) g
  82. module_param(acnt, int, S_IRUGO);; N; l" V8 Q) B5 T6 q% O, T' m. f
  83. module_param(bcnt, int, S_IRUGO);* o/ P2 ]" S5 V
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! F0 O7 t3 W9 ]
4 x( S% T# d0 q" n- ^, z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! a+ q1 ~7 H, ~( f; L, J) j$ uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ m! A- o% X9 J4 f$ `/ j/ u
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- r2 O2 H2 _. @, Z3 P" B

7 Y/ ]$ R6 J' R! j0 W+ Y8 W- c
1 r* ?$ v* C$ r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-24 23:56 , Processed in 0.045169 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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