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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 P: w8 m+ ]: f9 k6 q
  1. [code]EDMA sample test application
    , }2 g; J. m! D1 r9 H7 w. r- C
  2. /*, F% X, \. T2 J$ {& s
  3. * edma_test.c' Y, c) S- F" k2 U; S+ e# F: j5 n/ c
  4. *) b2 R' p8 }! y: g( v; A
  5. * brief  EDMA3 Test Application
    9 Y1 X9 B0 J' Z) R) q% W1 h1 @
  6. *
    0 Q# y+ N) W! [+ I
  7. *   This file contains EDMA3 Test code.9 O3 G  J( b7 r
  8. *
    - x" M0 ~# g* s- v+ q4 n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ n# `: T" L" B( b# v; g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' K9 f6 F! X- ~, s* X, u
  11. *         TO CHANGE." z/ v" [: n, O( }" `: d8 V
  12. *
    + g( {- R. ]# O7 }, x! H; H! U& L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  c6 E0 ~0 l1 K) m1 @6 b2 ]* G" [
  14. *
    9 [8 S, y) R9 P" |! g6 r
  15. * This program is free software; you can redistribute it and/or
    7 ?$ y; L2 y* |( C
  16. * modify it under the terms of the GNU General Public License as7 T% n# C- y& B4 L7 v
  17. * published by the Free Software Foundation version 2.
    ) h: h& U2 D( h3 |' {, L1 p3 W$ x
  18. *
      P2 r9 b! ?  Q) y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . Q6 \* h8 J5 G1 l" v8 v, A! I
  20. * kind, whether express or implied; without even the implied warranty
    + Y1 i$ T  ^: V8 J# T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 N. {" I; {4 i' V) x* e) m4 o6 {
  22. * GNU General Public License for more details.
    - j* ^, i; j3 }6 i: B1 |- b
  23. */" p$ y( G8 o( h& k, O2 K) t

  24. * o6 R& S5 _* A% n  m! g( ]
  25. #include <linux/module.h>
    . H. H! T$ i5 y; `, v/ A% O
  26. #include <linux/init.h>0 A2 Q  o6 }% H( a% q
  27. #include <linux/errno.h>
    , M# b$ S, v* u
  28. #include <linux/types.h>
    5 W* n% H5 C" B  @0 w* {8 U" y
  29. #include <linux/interrupt.h>
    7 n, ^5 d: p7 P' Z! G# H' b) W
  30. #include <asm/io.h>0 v  x9 F9 R& h
  31. #include <linux/moduleparam.h>; x4 v# |6 Y7 K: Q  H) ]
  32. #include <linux/sysctl.h>5 ~* `5 F, h& g/ a$ @/ g
  33. #include <linux/mm.h>& ^, K5 Z' y6 T
  34. #include <linux/dma-mapping.h>! d, a% |1 O4 w# V' _

  35. / D6 Z- X4 B. _3 x7 p! ]
  36. #include <mach/memory.h>
    : k7 t; G" J/ i6 ^) n! M
  37. #include <mach/hardware.h>! Q4 K5 C( q" H1 i+ F; J
  38. #include <mach/irqs.h>: ~& I, p% C+ w1 F
  39. #include <asm/hardware/edma.h>
    : W: I3 A- O! \3 h: o  h

  40. # c5 T4 _3 [; _+ t" g! w; A$ f. N
  41. #undef EDMA3_DEBUG
    9 I& @* ]7 r, S( u- K7 U
  42. /*#define EDMA3_DEBUG*/, F# z+ I# d$ p7 |+ e/ l

  43. 1 Y: F3 Q4 C0 I
  44. #ifdef EDMA3_DEBUG- B3 f5 ]0 `1 R3 `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 G6 Q- {# C5 m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " O- a2 q$ i& m5 J& n" ^# c2 ?( N6 I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" Y! h- O$ \% g% L4 `- ]2 ^6 `
  48. #else7 e+ q! i3 |9 }+ V
  49. #define DMA_PRINTK( x... )5 w+ i! k% h+ }; w+ Y# m
  50. #define DMA_FN_IN3 I7 I% F2 {+ f# Z0 C/ N
  51. #define DMA_FN_OUT6 c( J3 E' e6 u* K. ?3 F
  52. #endif
    , O+ g/ V8 I1 i( d/ H8 `( p' j  q

  53. 7 F* {4 }' I% Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 _  j; b  e) Z4 z. l: ~
  55. #define STATIC_SHIFT                3
    ; u* r8 [# U+ Y; u
  56. #define TCINTEN_SHIFT               20
    : V* w! ?- O0 s1 w" f0 Y; |% `
  57. #define ITCINTEN_SHIFT              211 ?- `! L* I3 n, |/ ]
  58. #define TCCHEN_SHIFT                22
    * W  y' ?* P' B
  59. #define ITCCHEN_SHIFT               23$ ]) H$ s( ~7 n. `

  60. . t, n. Q* ~) Z: Z; @- J
  61. static volatile int irqraised1 = 0;+ _% j$ S: w- d; h
  62. static volatile int irqraised2 = 0;
    % ~6 s# [& H5 u3 V1 T7 g- |
  63. ) n* e: d# b: K# c" C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) [" x) d6 n, }" ], V: E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & M, q4 k$ w+ V' @6 C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. E# H/ P( W) q, x
  67. ! y9 V5 _! }1 e# a
  68. dma_addr_t dmaphyssrc1 = 0;+ Q: H' {( G( \# A- {' p
  69. dma_addr_t dmaphyssrc2 = 0;& o6 Y7 L  F3 p# X
  70. dma_addr_t dmaphysdest1 = 0;: U0 f- h7 w: S4 {) z0 k5 i% b
  71. dma_addr_t dmaphysdest2 = 0;  n: b* @( f; k0 A4 {

  72. + \, p1 d) U8 @" ]( A3 S
  73. char *dmabufsrc1 = NULL;$ X5 {. o2 ^' i; A% b
  74. char *dmabufsrc2 = NULL;
    - c3 p: s8 d( S7 ?, G
  75. char *dmabufdest1 = NULL;! `, H% f# ^) n
  76. char *dmabufdest2 = NULL;
    6 T' w* \0 W7 z( C' v0 e
  77. ; D0 r( ]; G3 [# ~4 p
  78. static int acnt = 512;* S' z  ~1 L$ ]8 d
  79. static int bcnt = 8;
    7 c4 g: h8 @9 F* Y5 m) W% y
  80. static int ccnt = 8;
    9 t' z+ r+ F; V/ ]7 E+ t% Y

  81. $ N/ u6 D+ {2 Q6 J
  82. module_param(acnt, int, S_IRUGO);
    0 R2 M1 }; d5 O6 b8 P
  83. module_param(bcnt, int, S_IRUGO);
    2 c: |- Z1 A/ r3 k* D7 ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" A! \, j/ i: R
, a$ o! E( ]/ f, b8 ~& z9 b
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; i, Q' p5 d1 j/ b( Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 v' U" w1 b; w$ c. V  E     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* E- O6 n) e% |( c/ b9 j
' p1 Z' }! l  C6 N0 m

/ S( J6 }( E+ f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-21 04:12 , Processed in 0.040067 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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