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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " D9 ~0 B+ ~- z# ^$ h
  1. [code]EDMA sample test application% s6 I4 o$ j) y
  2. /*8 A5 K, G* n$ |* V; m2 E
  3. * edma_test.c
    , M  N, ~4 {. T' \
  4. *! z3 Y% N7 O- x  o
  5. * brief  EDMA3 Test Application( K' N7 ~) j$ b# m, q
  6. *
    + l+ R' p* O9 Z; d
  7. *   This file contains EDMA3 Test code.3 U: @* f0 g: Y2 p' Q# u
  8. *
    - ]% L( G6 _# U' F  T' ]: ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! r0 o$ T: E8 I. \, G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 Q3 ^6 l0 R2 Q0 U- v) i$ K( O
  11. *         TO CHANGE.
    # B4 a6 b# w3 H: L2 @6 ^$ ]
  12. *
    9 h6 j# a% H; m2 s5 }( ?4 D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% z% Q; _3 X' v7 q7 R* x8 }
  14. *- G4 o: {9 R- F) L# P
  15. * This program is free software; you can redistribute it and/or
      D& J& \2 Z" W9 m
  16. * modify it under the terms of the GNU General Public License as3 [  F8 C8 f; ~& r! c; G
  17. * published by the Free Software Foundation version 2.
    ; Z9 A' a( t, H1 h0 A! Z$ A
  18. *' i: D6 c7 {0 ?8 V! \; H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# \4 r) M4 T6 V4 f) D
  20. * kind, whether express or implied; without even the implied warranty
    3 o2 ~: o4 V  `" r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ W1 o" I! b7 q
  22. * GNU General Public License for more details.
    : ^4 @2 m$ s! |; x0 C& d/ V
  23. */
    % W  d: f: ^- G6 ^; U% _, ]

  24. ' V7 l( G' y" T7 O
  25. #include <linux/module.h>  a5 d# s& y3 ]( |: p2 A
  26. #include <linux/init.h>
    ' Y4 `3 @8 y$ |7 A/ a" L
  27. #include <linux/errno.h>; m+ p4 ~  O3 Y: o, q/ x
  28. #include <linux/types.h>5 R- |, m( S" H9 c
  29. #include <linux/interrupt.h>: ^" A( H" T3 b6 g, y9 y
  30. #include <asm/io.h>
    . Q( |* j: Y$ N* m2 L
  31. #include <linux/moduleparam.h>
    3 Y5 }& _& v  s4 w
  32. #include <linux/sysctl.h>) C7 i3 Y0 J, l6 s2 D* x! _
  33. #include <linux/mm.h>
    ) p9 N! U  F" ]
  34. #include <linux/dma-mapping.h>& _5 x# S+ [! m
  35. ( F9 X/ v: [2 |' k
  36. #include <mach/memory.h>
    1 h1 W! h+ B- T
  37. #include <mach/hardware.h>
    2 [: F3 ~9 k7 p; A" A
  38. #include <mach/irqs.h>1 y( F2 y" V$ ^8 |/ J# h. p9 Y
  39. #include <asm/hardware/edma.h>
    3 }& {  R: z- x! W% M) |" C
  40. & q3 `6 ~4 r) E7 T0 ?7 v
  41. #undef EDMA3_DEBUG
    9 ^. g2 \# h9 `% v# [7 ~( Y2 G
  42. /*#define EDMA3_DEBUG*/6 o" t% m9 Y$ b- c) T: [9 ^
  43. " j5 J; ?- g7 r+ x) ?( a: W
  44. #ifdef EDMA3_DEBUG
    # o1 F) J5 l1 ?5 M3 L, I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' t" Q. \4 H" _4 J2 R* U, V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 b$ t% [2 B2 [- m; x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " {7 ~  |' Q2 o7 Z
  48. #else- o: u& ~* }5 f7 E/ a4 |/ B, n6 {
  49. #define DMA_PRINTK( x... )! {6 r& H" e9 a
  50. #define DMA_FN_IN
    % F2 Q! Z; I* c% W
  51. #define DMA_FN_OUT
    - q8 W3 i: P( X
  52. #endif
    2 z2 N+ U7 D( C7 O6 X9 _9 T; c

  53. 4 u. W( Y% J) ^  p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 E8 d( v$ b  P5 K% E7 n
  55. #define STATIC_SHIFT                3
    ) k% X6 v; p' S' ~
  56. #define TCINTEN_SHIFT               20+ p& Q, s1 L# D! D1 f7 p1 s
  57. #define ITCINTEN_SHIFT              21, M" V% G, D6 n+ ]( G
  58. #define TCCHEN_SHIFT                227 z" M. }% K( P0 W  a
  59. #define ITCCHEN_SHIFT               23
    3 L; {, e- r- D4 V

  60. 3 j" q: y  |' L8 r' q" r2 j
  61. static volatile int irqraised1 = 0;
    + ~! n# D) ?! f" Z: i
  62. static volatile int irqraised2 = 0;3 N- X$ b& L1 j8 D6 z$ J* J

  63. " o8 o- C8 O9 K  g: g* a$ p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 {3 O1 m: N5 J4 G( V2 v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( ^: ^) v% n$ P9 a6 U: `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 I% T' j9 j0 N) O8 _9 [

  67. + G4 w" o* m3 W* n. m& M
  68. dma_addr_t dmaphyssrc1 = 0;
    * q+ h: E; q* Z. o, Y
  69. dma_addr_t dmaphyssrc2 = 0;
    1 B' C. E% \- E" o" I) u3 f& O' S5 `
  70. dma_addr_t dmaphysdest1 = 0;
    ) l4 G) k$ X4 b  y9 a7 ^
  71. dma_addr_t dmaphysdest2 = 0;
    5 S' X1 k8 Y: ^3 b, |* H+ a, [! ~  A
  72. 9 m8 d# c4 t" L7 d: M. y0 O# W+ o4 r
  73. char *dmabufsrc1 = NULL;* n1 d7 @! i7 b6 k8 w( }+ }
  74. char *dmabufsrc2 = NULL;; G7 E  G0 z& K6 T- z
  75. char *dmabufdest1 = NULL;
    4 Y4 m6 g& D. f4 F3 M
  76. char *dmabufdest2 = NULL;
    * a, k3 W# J0 D' n& _
  77. 1 U, p8 c: M; H' ]" y) o: R
  78. static int acnt = 512;
    ) Y$ T& }5 r( H0 H5 {8 F
  79. static int bcnt = 8;. c  z* m: V" E; J; K+ x
  80. static int ccnt = 8;
    4 o: }& h; V) U5 Z* t: ^5 j2 l
  81. ' ?1 ]3 z" o; v" Z! k
  82. module_param(acnt, int, S_IRUGO);
    / [$ k" g% w3 t; b' A9 ~: o
  83. module_param(bcnt, int, S_IRUGO);
    7 j( j# ]3 M) x1 H* z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 g- C0 [. v$ }* S! j1 p5 s. q& k$ \- C% Q" n/ z3 k
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, V( v1 y( H' earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 P3 z: }+ X: ~6 T' I     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" c9 J" O! z0 x! e' J: k1 V
0 ~9 n7 P+ L8 }% t  [% \$ d
5 g6 ?/ y9 ^. X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-1 10:44 , Processed in 0.038664 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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