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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" U4 n3 j2 `7 V1 t& i' `  P
  1. [code]EDMA sample test application
    2 U3 U- r* s) C" U1 o
  2. /*
    ) a. @" b0 C% H# ~8 f) x" r1 z- V
  3. * edma_test.c
      o  }# ?/ n2 N: l" Y! E( A4 K4 l' c
  4. *' p% t% E$ V& x6 f3 S
  5. * brief  EDMA3 Test Application8 u  R0 ?5 ~: |" X& R/ d% i+ i
  6. *
    9 d# d; n9 |% l. i/ A
  7. *   This file contains EDMA3 Test code.
    & z8 r8 g, ]/ r7 A- a2 F$ O
  8. *
      ]* {0 P0 b" q5 S" l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: [" p' s- E/ v: r: c0 M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 \, @6 ?* Z/ j+ k6 N8 F
  11. *         TO CHANGE.
    ! }. Z: P0 s7 B* t7 W
  12. *
    $ q, u' c4 Y2 W) Q. t& I/ ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- m5 y/ s  i* \
  14. *4 R  i+ u" v6 O- W% G
  15. * This program is free software; you can redistribute it and/or
    8 i6 e- ~5 ~" t. K
  16. * modify it under the terms of the GNU General Public License as* c! A/ N3 w, `+ g. N( Q* F# t
  17. * published by the Free Software Foundation version 2.
    / R9 R8 j6 M! A: l
  18. *
      R# p5 c3 g3 `: l* n" V5 _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & Q2 v/ V# g, S8 j
  20. * kind, whether express or implied; without even the implied warranty
    " [8 f" E4 b9 y# v: T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 m# K) s$ t1 ?: I2 O) m$ O# I
  22. * GNU General Public License for more details.
    " r7 c2 z9 M# Y7 A5 U
  23. */) k' P  b# T$ K# q2 C5 Q' q* p

  24. ( F) N; m* g9 p4 A
  25. #include <linux/module.h>
    1 A- O/ R( V3 r% h
  26. #include <linux/init.h>
    - i7 y# M, K. k3 x5 F
  27. #include <linux/errno.h>' p/ ^6 U7 Q) `
  28. #include <linux/types.h>
    7 I  g% Q* m3 S  n0 i8 D% s
  29. #include <linux/interrupt.h>
    , I& ?. M/ |+ n5 R0 f( c; w1 J
  30. #include <asm/io.h>
    & r+ w8 c5 K0 |# P) ~
  31. #include <linux/moduleparam.h>
    2 N! s& {3 N% K2 U" y9 Y1 A, A
  32. #include <linux/sysctl.h>6 y( e' u1 v5 a# {! ?/ a
  33. #include <linux/mm.h>" p' |0 L3 |' X
  34. #include <linux/dma-mapping.h>
    1 ?( f/ {  l% m$ ?
  35. 9 p  P9 V3 b' V. i! u5 g
  36. #include <mach/memory.h>
    5 P1 c2 x) J0 x- \( O4 p' b& G$ _
  37. #include <mach/hardware.h>
    - b; c# s! a% I6 b" P
  38. #include <mach/irqs.h>, E+ F( T# e% b" g
  39. #include <asm/hardware/edma.h>0 ?! u4 t# |# p& t0 b

  40. $ ]3 _. L7 K; U& o6 V# w
  41. #undef EDMA3_DEBUG
    6 m' F& w/ t, S  C- L7 ~
  42. /*#define EDMA3_DEBUG*/
    5 R+ H- E1 }- o5 {# H; _4 e
  43. , ~) r, }# {& u
  44. #ifdef EDMA3_DEBUG
    ) e/ _7 u! V# n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 B; \2 b7 E& J# c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " I$ z& M6 s& B8 E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ ~$ K- ?7 t. k, l8 ?$ A* [
  48. #else; J: Y! U2 H" O, F
  49. #define DMA_PRINTK( x... )
    ( I% z8 y8 T, G" M- l+ G) t" j
  50. #define DMA_FN_IN
    3 ~3 q0 u. Y# E. ?$ Z
  51. #define DMA_FN_OUT- Z  h2 @% v. ?  C  Z* C
  52. #endif
    8 T3 \: I. x) k: x, I
  53. ' O: O/ ]+ \/ u6 G* O+ Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * p1 d9 P: y! v* U
  55. #define STATIC_SHIFT                3
    ' o3 u  L/ t8 |2 T: B  D- o7 Y
  56. #define TCINTEN_SHIFT               20
    ; S: o0 _5 ]' ], m4 p
  57. #define ITCINTEN_SHIFT              21
    " d6 ]9 w! `: C% K, k
  58. #define TCCHEN_SHIFT                22
    + _1 W) u+ d: ]: j( X. `
  59. #define ITCCHEN_SHIFT               23
      f7 ?6 n" K/ X0 y# S% p: h* g
  60. 9 E6 y* O# c, _) e. j2 V- R
  61. static volatile int irqraised1 = 0;
    ( Q9 L% e! E6 y
  62. static volatile int irqraised2 = 0;
    . v4 [4 [' }, [& x
  63. , Z5 ?6 _4 H) w% K* ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 ]1 u! w7 q$ B3 c4 }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 q/ N. p$ v4 ?' d9 B- E/ h& i4 M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 x" B3 R, Q6 x9 n* {; ~0 I
  67. 4 ~3 @; P0 L% `! o
  68. dma_addr_t dmaphyssrc1 = 0;. Q7 T1 H$ O8 h" L$ |/ |- w" a
  69. dma_addr_t dmaphyssrc2 = 0;
    " s. M7 v) Z+ V8 W$ V* ?, Q6 m
  70. dma_addr_t dmaphysdest1 = 0;+ M; Y  L1 n9 g" T7 @  B
  71. dma_addr_t dmaphysdest2 = 0;' X2 N) H- F  q" H( l) U! p. l

  72. & e6 ~1 {- w. c  m. _' d9 }( y
  73. char *dmabufsrc1 = NULL;
    7 W' I  z  H. N& n: M# e: s8 {
  74. char *dmabufsrc2 = NULL;
    4 g! I& ]; Q( l' i8 @
  75. char *dmabufdest1 = NULL;
    . c7 Y# Y" e9 f. f6 o
  76. char *dmabufdest2 = NULL;
    2 \5 W& |! m& ?3 [* O  W' h7 S( d9 j

  77. 7 x! {$ P* D7 o# j
  78. static int acnt = 512;# v- `% F- L( P( j: @/ }
  79. static int bcnt = 8;6 r+ E: f3 W" z# n; `( i% f2 L2 |
  80. static int ccnt = 8;. y# }& }3 A& {/ A6 l* p
  81. ; Z+ }9 ^3 r7 K' K; ~+ J) U
  82. module_param(acnt, int, S_IRUGO);
    0 |( {# k4 [4 I& M5 o
  83. module_param(bcnt, int, S_IRUGO);
    , A/ P# O' D- f
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! V, `1 w7 D6 L& v

$ y# x- |0 b8 d( G- r      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! z) C) R' y, C  f; {5 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% H& e: A( Q. F) b     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# }+ ~+ W2 v/ {5 H; C4 h) y
5 p! p$ a  d# R" h. w! k
. ]+ S8 `; [5 ^# j. T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-21 16:56 , Processed in 0.037281 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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