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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 d# A1 M$ `' S; y
  1. [code]EDMA sample test application0 r, G; L+ Z2 I
  2. /*
    0 t8 l2 J; l' V+ t' K0 b
  3. * edma_test.c3 Q2 a  d! N: L( R! n1 c: w# N  C
  4. *# l2 W' a  G+ U; C2 l
  5. * brief  EDMA3 Test Application
    ( i7 \; Y& b" ?5 X. z6 n+ `
  6. *
    / |  m. C8 e& q- ~7 ?0 h6 F
  7. *   This file contains EDMA3 Test code.
    3 b- F) [1 N6 U5 X' p
  8. *
    / O; }. I; j! Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& I+ C9 T1 J% A) Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" |3 @4 I6 F8 G" D
  11. *         TO CHANGE.
    * z6 |' ?  E1 `. M& T1 ~
  12. *
    6 u) W' l" Y" v7 R9 R# E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! ]0 h: M0 g5 y+ `
  14. *% p, j5 R8 ?4 \5 c  }
  15. * This program is free software; you can redistribute it and/or
    ' V* W, ~2 P5 h
  16. * modify it under the terms of the GNU General Public License as9 M2 s  o/ b2 @" @+ f4 C
  17. * published by the Free Software Foundation version 2.
      P" Q  Q0 J5 \  U, r
  18. *8 w* b) u( x5 j/ X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. `7 e4 `0 m% z/ s
  20. * kind, whether express or implied; without even the implied warranty
    / \5 V5 I5 R$ i! N) ~) |) Q/ e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 b( E' n7 T2 S, e4 ]
  22. * GNU General Public License for more details.
    4 F' K: M" g! Q& ~7 l  `
  23. */* M. @* ^) C6 c9 \6 F/ W

  24. ( L7 g6 j9 p7 P1 }% ]/ Z2 G
  25. #include <linux/module.h>! h! z: d& l$ g" X/ ^3 ], A- v
  26. #include <linux/init.h>
    # N( ^6 D( h# V  K5 z
  27. #include <linux/errno.h>4 e: U9 d9 b' e& t5 h
  28. #include <linux/types.h>4 c& c6 [1 O& R  N8 F
  29. #include <linux/interrupt.h>: v4 t, q' ]" w6 k
  30. #include <asm/io.h>
    ) T0 f! T! n( N) j
  31. #include <linux/moduleparam.h>0 k; v1 @, N# V6 A/ J: L
  32. #include <linux/sysctl.h>
    # t& G( J0 q  \. @& o9 t3 A
  33. #include <linux/mm.h>
    1 J. u4 w" _1 p6 M+ i
  34. #include <linux/dma-mapping.h>, K0 A9 S9 |- [& v1 _0 A

  35. . \: _! ]# ?) X! P
  36. #include <mach/memory.h>
    ( e4 X8 G% S! q9 X, k* M0 j; P" ]
  37. #include <mach/hardware.h>
    # R* f$ O" ?. U# D8 F7 H
  38. #include <mach/irqs.h>
    3 L6 S9 S6 |% a& Z% D
  39. #include <asm/hardware/edma.h>
    - H. [: m$ a- t4 p2 C6 J7 O0 s
  40. $ s& I7 I' x. r. C
  41. #undef EDMA3_DEBUG
    ) w( y2 g4 j5 f! C) {
  42. /*#define EDMA3_DEBUG*/
    3 {5 P& W; X, n3 _) s% ^# T
  43. ( U' }9 x! R: R
  44. #ifdef EDMA3_DEBUG
    5 l3 b/ U( n, l+ z9 P. s% d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ R5 @- h  {9 ~4 K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" K3 v2 }3 ~8 P  P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! {4 W9 ]4 S( `
  48. #else
      R; E3 z6 f. ]! G" A0 j8 A  N
  49. #define DMA_PRINTK( x... )
    2 e2 F* I, n0 W/ T  S' a! |
  50. #define DMA_FN_IN. L0 U1 E9 f2 w! n
  51. #define DMA_FN_OUT. }7 x. x  T8 Y/ ~
  52. #endif
    % u5 x0 h1 u6 G8 E, C& U

  53. * K# l7 e$ ~& B5 E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( T3 ~& H, m1 ~4 l1 ^1 i$ f3 J" b
  55. #define STATIC_SHIFT                3- P" n/ L1 X  k6 k
  56. #define TCINTEN_SHIFT               20
    " |# m3 w( i4 Y% g: d5 q. q  r
  57. #define ITCINTEN_SHIFT              21
    : s+ F9 {' c. E) O& _
  58. #define TCCHEN_SHIFT                22" g1 z$ p6 v' ~8 n
  59. #define ITCCHEN_SHIFT               23* V, Z- [5 l! G+ Z! Q
  60. % F5 m0 W6 {9 R8 j# D/ z% j
  61. static volatile int irqraised1 = 0;
    % u! k* _( f* I4 }# H3 r; I
  62. static volatile int irqraised2 = 0;3 Y8 F" v# H' `4 ~. d) x& @
  63. $ J" y& D7 p! M! j+ M8 E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  {8 g7 G* w+ B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 P) Q" {4 X2 @' p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + f$ a* @  V+ {! _& z

  67. 1 e2 a$ x0 y  A
  68. dma_addr_t dmaphyssrc1 = 0;2 F4 N2 b3 Y2 [" @
  69. dma_addr_t dmaphyssrc2 = 0;
    3 e' l: u, J$ t& @* X3 r
  70. dma_addr_t dmaphysdest1 = 0;, I) F2 K+ S. E4 O2 S
  71. dma_addr_t dmaphysdest2 = 0;; ?: l0 Z7 |3 ^
  72. 4 l( ^  p2 c1 Y6 E  P- }. i
  73. char *dmabufsrc1 = NULL;- t0 V% `; j( v
  74. char *dmabufsrc2 = NULL;+ Q' s) j3 `3 F. k! B
  75. char *dmabufdest1 = NULL;
    7 i1 |& j8 }9 X! A
  76. char *dmabufdest2 = NULL;
    + O9 f& p' x/ [, e# S- O
  77. ) m& ]2 A' B4 n% x
  78. static int acnt = 512;9 N3 h2 @: j) m: V& \
  79. static int bcnt = 8;& o7 c, d/ R7 @# A" H; f
  80. static int ccnt = 8;1 ?" L1 [9 Q2 q( e  s) n

  81. 1 Y3 h) B2 r% }8 w9 w5 H
  82. module_param(acnt, int, S_IRUGO);# O: D5 n- r4 L  p5 _1 Q
  83. module_param(bcnt, int, S_IRUGO);
    & i, w  f* q5 q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 M9 \; n2 ^! s

; \- U; _" H  H; K# v' _" l" a      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  _/ i! Z" e( W' s9 p; Q; @. parm-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 W/ L" l  ~: G4 r" c( g& v     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 h3 f5 c+ \0 ]* _% B/ [  _5 L& J, o1 g: T

8 `$ ^+ L* S7 |2 O8 t; m" q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-13 01:51 , Processed in 0.043187 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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