OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! c$ _% O8 J; i* c; ^: ]! n5 C
  1. [code]EDMA sample test application& F1 ]) d8 W  R: w$ L3 Z& J' `
  2. /*- `5 K: z$ O5 T. B0 n. f4 o
  3. * edma_test.c
    8 O- P3 O  S# {/ n% ^9 L& R, i
  4. *' K0 `4 d* M& f: `4 O/ @8 A5 d
  5. * brief  EDMA3 Test Application
    6 E) g4 ^: Y+ v  z: r5 n
  6. *( K$ `! n% ?$ Y* N, n7 e
  7. *   This file contains EDMA3 Test code.
    ' c+ p9 D9 s9 j
  8. *0 n' \" I1 d5 x( m. @0 U' h* X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- m2 B9 L# p; n. ?7 m+ X' h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & R! ^3 j* E0 e
  11. *         TO CHANGE.) g; M" J; v+ Z8 h; u7 q( Y1 [5 F6 @. b
  12. ** ?. \7 Q2 `6 f% u& O" C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; {( g- s: o+ W
  14. *
    7 ~" l8 f4 G* j8 Y- F# ]2 I" ]
  15. * This program is free software; you can redistribute it and/or
    5 Y* Q) k4 o0 T) P1 x+ ^; i0 |
  16. * modify it under the terms of the GNU General Public License as# @% Q% A) c, U. u1 X5 n% |; ?$ s3 e
  17. * published by the Free Software Foundation version 2.3 R2 r8 y6 G( K, X- [: \, D5 |0 p0 w  \
  18. *1 m  V! C* d) Q, R! d$ Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) d3 u0 w# f+ x: f! [
  20. * kind, whether express or implied; without even the implied warranty+ |7 q* A+ G4 e0 f9 E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * d0 x# H7 n1 _9 Y
  22. * GNU General Public License for more details.
    6 Y2 I3 |/ _9 ^3 n, k
  23. */
    ' {& X$ K3 G5 ?  I" u5 e( B) R7 x
  24. ' r) t# |1 e8 `4 f. i- x" \
  25. #include <linux/module.h>
    9 k8 M$ R8 p( o' `' Q/ ^
  26. #include <linux/init.h>
    & _. g+ e/ m3 r' L# Z5 @
  27. #include <linux/errno.h>
    ) ]2 j: Q2 h. e# H( ?
  28. #include <linux/types.h>
    - I5 M& l0 y1 a) U8 ?3 F
  29. #include <linux/interrupt.h>( R! x; u- T, p& U& O
  30. #include <asm/io.h>5 M- `5 x+ ~9 i7 i
  31. #include <linux/moduleparam.h>5 ~) B' `8 G0 L* j0 n2 f  a0 r
  32. #include <linux/sysctl.h>
    3 L" t# G% e  l# j. f) e; a
  33. #include <linux/mm.h>
    . ]) l3 p5 c$ `; S0 F
  34. #include <linux/dma-mapping.h>
    ; B+ l1 l$ u0 D9 K2 M' k! ~: |

  35. - l" O2 q, Y& k% f; T2 w
  36. #include <mach/memory.h>
    6 n, b5 _8 d1 v# E6 l; N& t
  37. #include <mach/hardware.h>
    ! s  h( ]4 Q2 J
  38. #include <mach/irqs.h>
    1 Y% {+ k% \+ m
  39. #include <asm/hardware/edma.h>
    1 C% u; w# [3 b, i
  40. $ r5 x9 X- p. g, T& H
  41. #undef EDMA3_DEBUG
    ( S! R4 Z$ c- \- J/ `. ?$ u9 K
  42. /*#define EDMA3_DEBUG*/: H8 Z2 y* i0 J
  43. 7 k' _2 ]% o' l0 @1 D
  44. #ifdef EDMA3_DEBUG
    % Y; U$ m5 i2 [8 E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& U* ~. s1 S7 p- g% L) Y: L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- Q- N5 v$ ~+ `1 z# |: z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; s5 y7 d9 f" U4 J' H: w
  48. #else
    6 {/ e: k1 X* l; ~
  49. #define DMA_PRINTK( x... )  R, f" T2 _# Z8 O
  50. #define DMA_FN_IN
    : _. r' S# z# Z4 r
  51. #define DMA_FN_OUT
    ( t9 ?6 T+ R  y: y( ]
  52. #endif
    % A/ w3 m+ u# `: n0 K4 n! y

  53. $ Q3 h5 k, N) v2 ~2 E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 l/ y/ U8 d( Q; B
  55. #define STATIC_SHIFT                3
    5 d. q4 e* N, V/ V/ s- e* p
  56. #define TCINTEN_SHIFT               20
    . @, }( ]  ?0 S
  57. #define ITCINTEN_SHIFT              21# g1 V* h3 [  E$ Q9 i
  58. #define TCCHEN_SHIFT                22$ k/ c$ I2 i: D; F
  59. #define ITCCHEN_SHIFT               23
    + R' [9 }9 A6 Q

  60. " ^! u" e0 v$ O, v& o
  61. static volatile int irqraised1 = 0;0 q( `; e0 b4 Y, e7 b4 S! G/ \' f
  62. static volatile int irqraised2 = 0;
    9 T& ?1 v* Q: a; ]
  63. " n" q8 Q* y7 \/ c; T; L. h, B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 a* `' ]* h. W0 g) P0 r4 L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: A  G+ A3 }, x$ {3 j+ i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! R9 C+ h: w& j* T  i3 |5 A

  67. - W& V# ^0 W- b( \
  68. dma_addr_t dmaphyssrc1 = 0;$ s3 t" ?9 O; }5 a2 R  B9 H
  69. dma_addr_t dmaphyssrc2 = 0;
    1 e) \2 F6 \9 R* u6 M- b  [
  70. dma_addr_t dmaphysdest1 = 0;  x/ U, O5 o* y* l- H5 z. {
  71. dma_addr_t dmaphysdest2 = 0;* m* E7 P- @% [8 W: W# U+ g
  72. ( w: s# q. V$ u
  73. char *dmabufsrc1 = NULL;; B( \; ^6 p# N# l# |# F
  74. char *dmabufsrc2 = NULL;
    8 N- N' k, y- A& X
  75. char *dmabufdest1 = NULL;
    % e1 e3 M- w' U( A8 G$ U
  76. char *dmabufdest2 = NULL;
    0 P( @5 F: Z$ ~
  77. ! r& n) c1 k8 Y  [& m
  78. static int acnt = 512;
    4 n  N3 k6 l; w# y. v4 L# ]+ Q
  79. static int bcnt = 8;
    " S! ~) x- r1 Q+ h4 ~  t
  80. static int ccnt = 8;; ~% p# e: C; q2 G% w

  81. * \$ _; j1 v& N, H5 T% P* b, s
  82. module_param(acnt, int, S_IRUGO);
    - \( ]8 b$ ]9 e
  83. module_param(bcnt, int, S_IRUGO);! U1 V8 a1 ~' X' g, T. J' O
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" U% n; k' [9 M1 j9 t

3 K6 V2 x/ t" O% d      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 w% M. s: k) L: r- Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 O) [& C" m( V. _     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  ^3 C- d8 B2 V5 n1 `

3 ?* l( Z* s1 v& o8 r5 I; ~7 a4 k/ w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-25 06:22 , Processed in 0.051053 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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