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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 y$ C, P& V8 S7 m6 h
  1. [code]EDMA sample test application* E9 W: n% A2 B5 }; W
  2. /*
    ; J, Q. i+ E+ r- Y
  3. * edma_test.c
    $ c, C( q8 J; C: ~
  4. *4 q2 |7 w2 [- ~" s2 G( L- d
  5. * brief  EDMA3 Test Application
    - `3 S/ y& E; k4 v
  6. *
    % c, w0 D( `- I* T7 y/ N
  7. *   This file contains EDMA3 Test code.7 B( S: {# H- i
  8. *
    , z* }$ S; ?# d- n2 r7 |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( F; u2 ^4 l0 O. n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 Z( q4 A0 B* R" \
  11. *         TO CHANGE.9 T2 a" ^6 o7 j# R3 _) E  ]
  12. *& M7 l4 p+ ^/ |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 m. z, h1 r1 O, s+ K! ~
  14. *
    6 Q, u( d' f/ O: P' x* e
  15. * This program is free software; you can redistribute it and/or0 M5 G9 e$ L/ B* {
  16. * modify it under the terms of the GNU General Public License as
    ! n3 ~/ W, h0 b& C
  17. * published by the Free Software Foundation version 2.9 D% }4 g( p3 Y8 j2 p
  18. *
    6 X; U4 y6 C0 k* f& e, {; o( U( s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # g. N/ y+ I) w, v
  20. * kind, whether express or implied; without even the implied warranty, y+ _5 |4 V4 X3 c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, O7 U+ y4 x4 v3 R' U
  22. * GNU General Public License for more details.
    - o( v0 E  x# A
  23. */
    ! C. T4 G; P5 z- C
  24. , o7 t, N/ h' J1 w3 I
  25. #include <linux/module.h>
    7 ?/ ]9 p% d8 W0 P" ?% L" \
  26. #include <linux/init.h>  S7 |5 |" {5 t6 k: Z
  27. #include <linux/errno.h>
    / V1 q+ ]- X2 u$ f
  28. #include <linux/types.h>3 q, R7 ?9 q* m* D: N% }
  29. #include <linux/interrupt.h>
    # V* k& e: @3 t: s& u) n
  30. #include <asm/io.h>
    2 u; O' {5 Y( r* k# ~' D
  31. #include <linux/moduleparam.h>
    9 S2 B( c' \1 o  u
  32. #include <linux/sysctl.h>
    - V, S7 g1 r7 B8 L. m% p6 T/ ?
  33. #include <linux/mm.h>
    7 N; O, R7 _9 L" a
  34. #include <linux/dma-mapping.h>7 k) K* I( ^3 E" C. P8 T  ~; u
  35. 5 Q' k9 U8 C* Q5 Q. k0 Z' e! a
  36. #include <mach/memory.h>; S6 [6 s, _; J' H$ a( [; X$ V
  37. #include <mach/hardware.h>
    5 U) V( O2 k/ u) g0 R) @
  38. #include <mach/irqs.h>4 E2 A; F4 ^+ D! C
  39. #include <asm/hardware/edma.h>) b, @( z5 q* u2 Q. ]' p( v

  40. % x. Y. k2 ~* E* S
  41. #undef EDMA3_DEBUG
    ; q0 D& O5 T$ c" ~. Y; M
  42. /*#define EDMA3_DEBUG*/: h) ?/ @$ d" |! E6 [6 x
  43. / j- j6 ]" Y, Z5 ^2 ~
  44. #ifdef EDMA3_DEBUG4 `" f( Q# d' V# p, @3 C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ A9 U8 j4 {3 n3 s7 x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / M* I- r6 l/ z9 e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 E+ J& K; V2 w# D) q) e
  48. #else6 L% Y) `3 L5 ?8 ?: u
  49. #define DMA_PRINTK( x... )
    1 u" C% M4 k% v, d7 A) @8 @' h) R
  50. #define DMA_FN_IN
    8 Q0 C4 s4 m8 F) L, n' E0 h
  51. #define DMA_FN_OUT) {2 C* D+ E8 G+ q" s: i9 L8 r
  52. #endif6 t$ }; s6 q! X/ a- m

  53. , w! C8 l( F' v  t8 Z; _' b" j$ b* |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 @/ C+ v4 ^7 K1 T0 y
  55. #define STATIC_SHIFT                34 F% N/ Q7 v" U$ y3 A- k
  56. #define TCINTEN_SHIFT               208 D. B( r# j, \8 k  b; w, q
  57. #define ITCINTEN_SHIFT              21
    7 M. |4 [1 f9 N7 J  `
  58. #define TCCHEN_SHIFT                22
    & M. W; k% V- o4 M  u6 |* U6 k4 g
  59. #define ITCCHEN_SHIFT               23
    3 h7 W8 p! X5 c1 }

  60. ; Z6 P' r, l# Z$ c2 o
  61. static volatile int irqraised1 = 0;
    ' X5 R" s$ i9 I" ^' q% b# e
  62. static volatile int irqraised2 = 0;
    3 f) z  J. ~; d

  63. 2 T6 U1 e9 a# ^- P1 z" r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 K4 `( K, G8 I- p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # S- H4 i0 a6 S& q. Q" c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 Q! x* E6 D1 i; S: Y6 U1 W6 r

  67. 5 c3 F1 t" O1 r9 {9 L: {' t# ?
  68. dma_addr_t dmaphyssrc1 = 0;
    $ I2 I' i# y" M/ l5 P! \
  69. dma_addr_t dmaphyssrc2 = 0;
    4 L; E1 A/ V" j) e& g' r4 Z2 o  C
  70. dma_addr_t dmaphysdest1 = 0;
    - C  S, s* B: |7 ^5 i3 v
  71. dma_addr_t dmaphysdest2 = 0;$ C# U; i/ I  n3 e! W0 e! K  n

  72. ! A: z5 B2 ]- l' E* ^
  73. char *dmabufsrc1 = NULL;
    % w/ ?3 [  l3 U+ y
  74. char *dmabufsrc2 = NULL;" f# M3 u- o; P# ^
  75. char *dmabufdest1 = NULL;
    - `1 _* j5 ~* i
  76. char *dmabufdest2 = NULL;! s( L: t( `" ?/ p; [- B
  77. ) A+ @. H/ J$ ?) k6 J$ [4 @8 Q# W
  78. static int acnt = 512;
    2 X  Q6 d1 d# J1 o
  79. static int bcnt = 8;, A/ b- {+ ?+ C% [& B
  80. static int ccnt = 8;
    5 ^; a" Q1 W" A, d* q6 `0 [% Z

  81. % v: n, u2 m6 [
  82. module_param(acnt, int, S_IRUGO);
    8 l, n% s9 h& ^+ F5 O0 G/ X# e
  83. module_param(bcnt, int, S_IRUGO);
    ! H- C% f5 X  q3 ]  B! _
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 R: `3 \2 Y" P+ `1 C8 Z" K1 B$ Q, O
! l8 I, |/ s# [/ `" J* _# Z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' \5 h) L$ r' y  J" H3 j% tarm-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 v7 D9 Y; A& v2 f; H) U* |     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* g5 e. _' E6 I0 K. C% O; R

( }' h6 E8 Y, e7 j, [: L: |8 u: L# t6 s4 W% {9 g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-12 22:11 , Processed in 0.041666 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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