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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 q- U4 a! x3 K7 k1 Q/ x. r4 c
  1. [code]EDMA sample test application, y8 S, K9 m% ~% y
  2. /*
    & h- T7 h3 i- c& l- k2 N
  3. * edma_test.c
    * d% ?* P# |8 ^* Q% }$ e
  4. *% C2 D) b! b1 b: ]% ~3 q
  5. * brief  EDMA3 Test Application
    : W- ?0 [5 z2 s  M3 h
  6. *
    / w4 Y. g* d7 C; H
  7. *   This file contains EDMA3 Test code.8 l8 ]" {, O& ]; V  d, V
  8. *
    * j, {8 a: p6 E( b- \9 l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + S8 V6 g. K/ y/ B5 C: \$ \6 S4 x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 l9 c5 R. [% X3 @* R
  11. *         TO CHANGE.
    . }( F5 F/ w3 _, L
  12. *9 m7 P5 b, E! @" I. q# V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' c) O; [3 C9 j8 D  W5 Y
  14. *
    ' y4 W& P6 K6 y" c! d2 `
  15. * This program is free software; you can redistribute it and/or6 S; M5 t0 C9 l1 H- s
  16. * modify it under the terms of the GNU General Public License as; w) ]8 g; G, t5 g& @
  17. * published by the Free Software Foundation version 2.
    % v* l3 M+ o5 a
  18. *
      }( g8 C% M% ^5 [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  T- o; P$ `) z% P
  20. * kind, whether express or implied; without even the implied warranty6 y# q- I1 e4 q: x* k/ I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % j9 q1 w" P7 z5 y4 S  J7 v) q
  22. * GNU General Public License for more details.
    % v- p/ C- T0 Q* l. T+ p4 ^
  23. */
    8 y/ d' r; h. r: `* J
  24. , R/ T# e. W& k8 k
  25. #include <linux/module.h>" ?, A7 O; b$ r9 |# R
  26. #include <linux/init.h>
    8 [3 U& }1 m* S" f
  27. #include <linux/errno.h>
    9 l$ q( H6 r7 ?# H
  28. #include <linux/types.h>1 a/ J) F' f- t& H8 B
  29. #include <linux/interrupt.h>
    . j9 P: a% T+ a6 g* {9 S5 E
  30. #include <asm/io.h>
    * J  D  l" |. L7 G# i
  31. #include <linux/moduleparam.h>
    . g6 k4 F* z$ s( T
  32. #include <linux/sysctl.h>7 N, o6 ^( h5 C6 [; U
  33. #include <linux/mm.h>
    9 o$ [' v* g+ a+ U: _1 i
  34. #include <linux/dma-mapping.h>
    ) j/ m- P$ ^* G3 I) G/ B

  35. - R9 ~$ P. w) S
  36. #include <mach/memory.h>2 j& ~+ O: P- W  l
  37. #include <mach/hardware.h>
    8 |1 }) z1 \# {2 z
  38. #include <mach/irqs.h>3 p* m4 B) ^2 {
  39. #include <asm/hardware/edma.h>
    $ ^: T& S  A% T( J5 k; N9 t- T
  40. ; M, A' _  t  I  d
  41. #undef EDMA3_DEBUG
    * T3 I: Y' w/ e& f6 N4 D
  42. /*#define EDMA3_DEBUG*/
    9 g0 C2 p; _! H' E) J3 ?5 \1 y
  43. 1 ?8 f8 t) y+ C& q' N- D+ B. i( r
  44. #ifdef EDMA3_DEBUG
    ! {& J0 @0 E( O+ y9 N0 I4 u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' j2 f; r6 Q5 L' ]. F# y% @8 o$ j' M' n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 z+ x! u9 S. g" n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& ~1 s8 }& C  R! C+ w; ~* _
  48. #else
    2 }. ^% P/ W$ i# p' M: Y! M! R
  49. #define DMA_PRINTK( x... )
    5 o. n7 f7 l% w8 Y
  50. #define DMA_FN_IN2 q0 U; J( Y# }& a
  51. #define DMA_FN_OUT
    1 P' R* [! V: O. u* {0 V4 l
  52. #endif
    % M3 G' s2 D. `$ J. P. ~
  53. % n  X1 a5 }5 i% e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 l  \- B; h  I  Y! Y
  55. #define STATIC_SHIFT                3' V8 V% D+ L  g
  56. #define TCINTEN_SHIFT               20
    9 ]! y# m( c! ^4 Z  F
  57. #define ITCINTEN_SHIFT              21
    : @8 @: ^6 X- ~1 q( J$ M1 k8 f  }1 k
  58. #define TCCHEN_SHIFT                22: m2 [# p0 w* I4 A4 Z; W$ P
  59. #define ITCCHEN_SHIFT               23
    . r1 T1 k3 k7 @' E9 |: N
  60. 0 Y( V! G, U" e) C0 n7 F) b
  61. static volatile int irqraised1 = 0;
    2 r- `$ |' E8 N* N* k* L2 _8 |# r; R4 `
  62. static volatile int irqraised2 = 0;" J% D5 r+ _2 g5 o3 W1 Z8 c: p
  63. 8 `  B% M6 q1 U' ]  Q) e7 G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( q* A$ K( \7 e- K, C! g0 e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 Z0 k$ _8 o7 X5 b% u; Q9 X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% s& `, \" R7 R7 w! g4 P, ^
  67. # S! b% D. A* W
  68. dma_addr_t dmaphyssrc1 = 0;/ j7 m! t: p! M3 ?3 s7 @7 i& m5 _
  69. dma_addr_t dmaphyssrc2 = 0;3 k" k& x- s- g! `7 Z
  70. dma_addr_t dmaphysdest1 = 0;
    7 b5 K2 g( ~! W1 {
  71. dma_addr_t dmaphysdest2 = 0;3 m  `) i4 f. q# n/ g

  72. + U3 ^6 V3 T% J3 {9 _; Y" d4 a
  73. char *dmabufsrc1 = NULL;" T! d0 w( o/ z1 Y9 B
  74. char *dmabufsrc2 = NULL;
    6 C: Y0 t& m% C
  75. char *dmabufdest1 = NULL;
    7 E2 Z9 S* Y8 k9 B" z% W" {5 E
  76. char *dmabufdest2 = NULL;; g% d+ T, ~, V% g  T# l. [

  77. / _, C0 S# I: s$ F9 F/ G5 [: W6 t
  78. static int acnt = 512;
    1 s6 U. ]  u+ @. E7 N  @
  79. static int bcnt = 8;/ e1 H: y: \6 X7 a. Z# d8 Q
  80. static int ccnt = 8;" e# K0 d  h! U
  81. ; N( {; J1 q5 `
  82. module_param(acnt, int, S_IRUGO);
    ; ~5 U- `; `8 A! m# b! e1 ]
  83. module_param(bcnt, int, S_IRUGO);
    7 D$ w+ C( J5 m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. \4 M9 g; U3 j8 i6 S
" `* k8 K7 s4 u0 m9 j9 A( M+ n6 H( h      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 {/ d3 p! P- Y- e2 O1 S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# ^1 Q* |2 v+ f0 K# }* G
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 Q2 K6 L  r7 Z! a  O) W/ b# a8 E+ L
2 ~6 \. |* _+ m# R: F2 K' j) o9 a1 R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-20 03:42 , Processed in 0.040482 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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