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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, r0 E( N- G) v# K
  1. [code]EDMA sample test application/ l1 V! B  s0 A- a! N' b2 ?! }
  2. /** R6 B; m* q% a, Q' {
  3. * edma_test.c
    4 l+ T6 F, x1 z* E4 b% {% ?) L) [
  4. *
    8 t/ `) b/ P) m3 s+ ]
  5. * brief  EDMA3 Test Application
    4 A& }! F. X$ \
  6. *
    . j4 ?* d: u# _
  7. *   This file contains EDMA3 Test code.
    + L( ^& G7 r  F5 M
  8. ** T5 O/ Y1 |4 Q! G) h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ R/ e+ x; f; I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& E8 _* J8 n, ]! `4 O* e5 q# j
  11. *         TO CHANGE.# {0 @% Y3 T: B* ?3 Z
  12. *3 s8 E) j+ `+ a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 Z; g. [+ ~9 w1 D! ]0 k# M
  14. *% R# O0 f  G7 O
  15. * This program is free software; you can redistribute it and/or
    ; w5 m& \6 D& Z* ~: R& w( |
  16. * modify it under the terms of the GNU General Public License as
    " i8 o5 E5 o4 N
  17. * published by the Free Software Foundation version 2.* Y/ y% {* X, {7 e6 h5 F
  18. *$ J- ^& f" A  o' D1 Z& n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) N* b. [6 G/ }9 b$ Y: b* o9 N
  20. * kind, whether express or implied; without even the implied warranty
    1 p7 b% Q/ a- b% n7 P  z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % L1 K7 l: N) o: Z% u7 E6 w
  22. * GNU General Public License for more details.
    1 [$ h3 P" _! h0 }, Y
  23. */
    ( q! S  ^. k  q, J+ N

  24. / T# }6 ?& M! q/ k$ u
  25. #include <linux/module.h>5 l# z. {+ y4 z" t8 S
  26. #include <linux/init.h>
    + _* p! ?1 u/ U6 }  w
  27. #include <linux/errno.h>% D4 p/ @: {" U3 l+ a! k" t
  28. #include <linux/types.h>/ S" j# ^1 m* F, G0 M8 v2 P: S9 M
  29. #include <linux/interrupt.h>
    5 k; p$ e/ ^$ K2 T
  30. #include <asm/io.h>2 X- _* w4 O6 ]( n8 E
  31. #include <linux/moduleparam.h>
    ( k/ {/ ?' ~1 H6 }& b0 q6 |
  32. #include <linux/sysctl.h>! }7 }/ C, n! ^( \
  33. #include <linux/mm.h>: w2 [* z# n" v# X' a
  34. #include <linux/dma-mapping.h>; B* x" k' ]; e& Z9 v6 B1 S. v( S
  35. " @+ V" [* |: K3 g
  36. #include <mach/memory.h>
    2 K) v: a1 r6 {# o) `
  37. #include <mach/hardware.h>
    ' j6 @' H& a, T: w- C$ ?, W/ X
  38. #include <mach/irqs.h>
    1 R  [, z! n7 D5 X. w3 Y# S
  39. #include <asm/hardware/edma.h>) L7 R/ G/ O8 |* ~$ Z7 G
  40. ; J5 I5 W0 h' \) s+ C( f. @
  41. #undef EDMA3_DEBUG
    % W2 ^4 y6 Q/ ^7 S* E/ P- `- L
  42. /*#define EDMA3_DEBUG*/- Q/ q! `: v2 r# a  l7 j

  43. 8 Y+ E, ~! T! ~5 l
  44. #ifdef EDMA3_DEBUG
    / {3 u/ a: C8 Y& v0 K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ V' e$ b" T, Q! s! j0 x# {* d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 L' Z; y% x, B- q7 T6 K4 x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! e4 N( g& s4 r; K8 J/ |$ z
  48. #else
    ; Z2 Q* _) H* `" `( P
  49. #define DMA_PRINTK( x... )
    " ]% n  ]4 Y- q. U
  50. #define DMA_FN_IN
    7 a8 k! a3 g5 o+ V
  51. #define DMA_FN_OUT
    " v/ u/ L4 z8 h' r! [. S$ O
  52. #endif
    8 I4 ~  C4 b, O
  53. ( e5 ?" v" @( i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 P, S' ^6 \; r% \7 m7 h; n9 R
  55. #define STATIC_SHIFT                35 f; X+ _3 `: g
  56. #define TCINTEN_SHIFT               20
    : ?+ O+ n6 q; B% }
  57. #define ITCINTEN_SHIFT              21
      V, l# J( i6 b/ d! E: U
  58. #define TCCHEN_SHIFT                22) e6 a5 K- Q1 V" k6 \
  59. #define ITCCHEN_SHIFT               23
    9 n6 ^- \* k* _' S, a  }# Z0 V

  60. 7 M6 R# \7 c6 i* ]
  61. static volatile int irqraised1 = 0;
    , C+ c8 G' M3 Y5 s3 k8 C- d% }0 R
  62. static volatile int irqraised2 = 0;9 b" k$ D2 P/ D& ^
  63. 2 y. A  b$ B7 L7 Q( ?: f7 c, P' y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! u+ |2 ~( P0 D) k# w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- c5 p, G1 d5 m; S% e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- _' Q2 f: g' A# C+ {* I7 Z/ P
  67. 5 w  T$ q) G, F
  68. dma_addr_t dmaphyssrc1 = 0;
    . m! H1 Y4 h4 X
  69. dma_addr_t dmaphyssrc2 = 0;
    . B  e: W0 H( [- q9 V
  70. dma_addr_t dmaphysdest1 = 0;
    " A* y% h+ F2 y1 X+ z4 f2 i% n
  71. dma_addr_t dmaphysdest2 = 0;
    / d6 K; a8 k, X% J& J' }& \

  72. ; l+ `  I( f0 ^% Q
  73. char *dmabufsrc1 = NULL;" ~6 H' l, u% V  u
  74. char *dmabufsrc2 = NULL;
    8 n) |- a+ h7 [: F: s6 L6 q
  75. char *dmabufdest1 = NULL;
    6 x1 X  D% D( @
  76. char *dmabufdest2 = NULL;
    1 e: B6 I, ~" I: {

  77. + I" \: B- e$ y7 C5 U6 \
  78. static int acnt = 512;
    + V  K) e' U4 t3 p3 p7 N
  79. static int bcnt = 8;1 u7 m2 U9 O' i/ U" i9 [7 L, \
  80. static int ccnt = 8;
    9 ^4 y# d  M1 k6 g& q9 u" ^$ {  Q

  81. ! R( ~$ j$ S& Q" f8 l3 d2 I6 H$ a( {
  82. module_param(acnt, int, S_IRUGO);5 n% m: y. t  K- R
  83. module_param(bcnt, int, S_IRUGO);! }" D& f# m# L9 k
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' m" u( w; E7 ?

& x8 @  {9 h$ J: B: E. m      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 X7 K- }2 _7 Y' N7 O- L8 Q
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 D- `9 v! w, r4 q$ {+ U
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( T3 f8 C. Q2 O" ?) K; u9 c$ E/ N
- D; t& o% d$ b% K2 J
6 V) \4 h  {4 G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-30 21:21 , Processed in 0.044185 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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