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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 f6 n) {6 l0 p+ I9 R/ S
  1. [code]EDMA sample test application
    ) z) L2 N/ _$ z7 h: j* n* K6 u  f/ V# I
  2. /*( A8 N6 c0 \$ d; M) d' _
  3. * edma_test.c
    . c  i& m" z, F- V( s6 v6 J
  4. *
    7 ?8 G6 w2 ]0 }/ ^0 s
  5. * brief  EDMA3 Test Application. ^6 K) [# k: U
  6. *+ g9 |. B. n3 U  c+ j8 W
  7. *   This file contains EDMA3 Test code.
    $ S; z$ s0 p, v* _
  8. *
    0 X: ]! _6 q1 \5 ^- e& |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; Q* w4 G1 m+ {% G' f& D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- b: V4 r+ Z$ b
  11. *         TO CHANGE.: A8 B$ M9 \- V# @& Y
  12. */ |+ y. [+ C" N( J  s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( Y1 ?6 V, _& W2 I2 x. W0 H
  14. *
    , m3 u9 A& I- F+ R% ]3 W
  15. * This program is free software; you can redistribute it and/or" n/ g2 {1 [1 u. e& u' w4 Q; ]4 g
  16. * modify it under the terms of the GNU General Public License as
    & G. p8 u6 a* H9 E
  17. * published by the Free Software Foundation version 2.
    3 T4 m) F5 ]. i
  18. ** g1 z! ?" k5 B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' U- f! z; j' }$ v
  20. * kind, whether express or implied; without even the implied warranty
    ! f: _. N7 C5 U( u5 U( O  r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / [5 Y$ Z  h8 q  ?" c
  22. * GNU General Public License for more details.
    ) f. h: `; `' [( K
  23. */& T+ I+ x# F4 r  ~

  24. # n& \1 b* E! a$ @
  25. #include <linux/module.h>
    . R$ x9 Y0 ^0 i/ @4 R
  26. #include <linux/init.h>: n4 I/ {5 ?, L& I
  27. #include <linux/errno.h>
    ) H8 w8 E3 E. ~+ P: {( ^) o
  28. #include <linux/types.h>
    ; c5 E) K8 a  C3 u8 v, L
  29. #include <linux/interrupt.h>5 e; m4 b) v' C0 z
  30. #include <asm/io.h>; J" _4 m+ G# s! F
  31. #include <linux/moduleparam.h>2 K& j# F# ~7 q" o4 e
  32. #include <linux/sysctl.h>. X1 x0 Y+ J1 J: m7 K
  33. #include <linux/mm.h>; I5 D( J# W# N
  34. #include <linux/dma-mapping.h>& `/ h& }* v/ O: P! X& @
  35. , w! g; H8 b: }, q
  36. #include <mach/memory.h>
    0 U7 @. l# F8 p. E4 i1 M- R* q3 h
  37. #include <mach/hardware.h>
    & h, V" a8 [- H( `
  38. #include <mach/irqs.h>  E1 M, N* r+ e3 v
  39. #include <asm/hardware/edma.h>& i: H2 |( k3 U. }; l4 t
  40. + a4 ?0 O& t7 K6 @& q  l
  41. #undef EDMA3_DEBUG
    & z( \+ j: N  r2 `
  42. /*#define EDMA3_DEBUG*/# k( x. ?6 c3 _9 F# q; ^
  43. 7 ?8 ?$ h: O; M1 S
  44. #ifdef EDMA3_DEBUG) {: p( v1 a" G" b) }3 g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( t1 q0 X6 n$ Y0 ^% y. v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 ?7 R* N- S# Y# I) V7 [% f2 e" f* r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' g% l9 C0 o; a, B1 W0 X
  48. #else
    - x# S- I5 z$ f' v4 R
  49. #define DMA_PRINTK( x... )( U$ q" {5 b0 t3 B3 {( ?7 {" X
  50. #define DMA_FN_IN2 G2 a& S; o3 \5 K0 r' G) Z) a
  51. #define DMA_FN_OUT0 K& M) V+ T9 V: L; r9 V* o7 @
  52. #endif
    $ m# p$ ]4 t; g. ^" r. C

  53. 6 Y3 c, l  n2 C- _: W. P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 G3 I9 U: Q- n  W
  55. #define STATIC_SHIFT                3
    8 J$ W4 }& j! [9 J# j) V! @4 b
  56. #define TCINTEN_SHIFT               20
    6 M7 X& `' t2 h( Q
  57. #define ITCINTEN_SHIFT              21% \# p0 i* k1 V+ a
  58. #define TCCHEN_SHIFT                22# F% L4 O3 i( z9 L, a
  59. #define ITCCHEN_SHIFT               23
    9 w. @9 q! N8 M# `: o# f

  60. + E1 G8 D6 l* |7 \/ f
  61. static volatile int irqraised1 = 0;
    2 i/ t  E, y6 Z8 M' p) F
  62. static volatile int irqraised2 = 0;5 O, E# J# `" f. c& }
  63. 1 K! Z! M9 N' h& `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . Y/ x+ Q( q5 h! G9 b8 p4 R$ P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) E& N3 m  P/ F$ ?9 a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 b- a& o9 l* W  M8 N5 W* F4 h
  67. ; ^; v% y3 U% l- e0 W
  68. dma_addr_t dmaphyssrc1 = 0;: l3 e% n0 v% g% Y7 s" Y
  69. dma_addr_t dmaphyssrc2 = 0;4 q& J, g* |7 R3 l( K3 F4 W9 ?
  70. dma_addr_t dmaphysdest1 = 0;
    ; D0 M( P; s# M4 s, n
  71. dma_addr_t dmaphysdest2 = 0;2 [: o- l4 x1 _
  72. . K$ M/ N" `  d. r1 }9 j1 D
  73. char *dmabufsrc1 = NULL;5 V4 i( ^# V9 |; _
  74. char *dmabufsrc2 = NULL;  i+ i$ Y! o) Q/ g
  75. char *dmabufdest1 = NULL;
    0 X% H/ x( C: t! ~" l) e/ s# }
  76. char *dmabufdest2 = NULL;
    ; n  M* d, N! ^. F
  77. 7 L0 T1 a' e7 c4 @3 N; A
  78. static int acnt = 512;
    8 x8 J1 v: [  i7 n! _
  79. static int bcnt = 8;/ v5 M) |7 R5 \2 e  h
  80. static int ccnt = 8;* r- k/ X0 P! }# \! v

  81. 6 b, `+ x$ s  Z5 @
  82. module_param(acnt, int, S_IRUGO);
    - g8 [+ ?6 f. r( o& `' f  f/ i
  83. module_param(bcnt, int, S_IRUGO);
    ; s- C0 B6 e* Q' S0 t2 O
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 }2 k# o# v% o
9 [6 G2 c6 r7 w% @' E+ Q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 x/ R& ^. V  X/ O3 }' ]8 [9 farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& d8 N1 }0 B7 z1 l" L8 G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; C( M4 _; g3 D8 _! _9 D& O; X
: U5 x2 A$ _0 t
1 `3 q6 P" u* {+ c1 ?  \7 X% }' }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-20 22:59 , Processed in 0.038809 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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