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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 q" s# }" D3 s0 w  e, f
  1. [code]EDMA sample test application; e  P& Q, t/ k" X" p% }9 v8 A9 `
  2. /*3 \& [/ K! ?. n$ D$ q
  3. * edma_test.c
      d: ?' z. G* w
  4. *3 f# A2 D0 ~2 A8 B0 ?6 V& R3 |1 L1 n
  5. * brief  EDMA3 Test Application
    5 [7 _4 D7 Z$ [- s
  6. *. _- c5 @& k: J( h! e2 G
  7. *   This file contains EDMA3 Test code.
    ; I! `2 G+ v$ H0 D0 B2 r5 i$ a
  8. *& ~$ d# b" \( d  U/ v: U9 ]5 ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; R4 y3 v  G- i8 q) L% S( e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* P& `* g/ K2 D& f
  11. *         TO CHANGE." K" I& C3 J( V5 O* s3 t# g
  12. */ v% I6 X; z1 F4 r; X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; }5 F" Q! s9 o: Y+ a% A1 ]
  14. *
    ) S( z/ X9 H1 l5 H" c) z& C; I
  15. * This program is free software; you can redistribute it and/or1 t+ T1 |  i1 I
  16. * modify it under the terms of the GNU General Public License as
    2 i" j+ H* l8 f* d
  17. * published by the Free Software Foundation version 2.8 L1 ^: D" [3 e9 O0 D
  18. *
    + `" ]) m7 ]2 y0 z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 I" M$ Z, `0 [6 s2 P  o0 u& `' l
  20. * kind, whether express or implied; without even the implied warranty! ^% c$ z$ i" J, f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " w8 q- t2 I# _$ o
  22. * GNU General Public License for more details.
    2 q# h6 X: W: p4 a7 p
  23. */) L; M+ J: O" ]5 Z  }1 H
  24. ! u0 Z+ h( Y+ q
  25. #include <linux/module.h>$ S5 R+ Z& @6 Z, T, q% n
  26. #include <linux/init.h>. ?( }/ G& ]. D
  27. #include <linux/errno.h>: w0 c5 g, o6 ~7 y
  28. #include <linux/types.h>
    * Y# C) \$ \* h  I& m6 _
  29. #include <linux/interrupt.h>
    ; M0 {! v$ N2 P/ }% a/ Z4 N
  30. #include <asm/io.h>' n4 D  G6 N0 P* a; B! \2 I
  31. #include <linux/moduleparam.h>/ s- Q# p. P! E; E
  32. #include <linux/sysctl.h>1 r- \) g  Q, d7 k) a! C9 C
  33. #include <linux/mm.h>. ?. V2 q# |4 \/ L# K
  34. #include <linux/dma-mapping.h>
      d8 X/ i/ a0 {4 y! L6 n, h& V( i

  35. 4 c3 r( A. T% \5 {6 v
  36. #include <mach/memory.h>. a- V, K& h; q8 L( u+ ~
  37. #include <mach/hardware.h>+ i: D" t) d# \& i, R
  38. #include <mach/irqs.h># a! ?7 R6 k2 v) d% B
  39. #include <asm/hardware/edma.h>
    ; l: O9 D' v8 V. T: g
  40. % Z8 b0 s% V. F/ {1 J4 A' `; K6 S
  41. #undef EDMA3_DEBUG% V0 X; R+ K2 r. p
  42. /*#define EDMA3_DEBUG*/
    5 g" F1 Q6 f6 ]1 G

  43. 0 G( R- ]' W6 V% s* o3 o" g" p% F
  44. #ifdef EDMA3_DEBUG
    * S* B' g2 O  a0 a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ \9 r" V5 a) F, ^& b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): r- l  D' G4 H3 A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# M9 c, d+ S$ e1 P$ n* c( P$ b
  48. #else
    8 U" W/ q6 h; m. ]# U1 B
  49. #define DMA_PRINTK( x... )
    / {6 `7 [7 Z1 Z
  50. #define DMA_FN_IN
    - h- _! \1 s$ Q$ m6 B; C6 s' C6 t* l
  51. #define DMA_FN_OUT
      w  V7 ^) P9 h" n$ E
  52. #endif
    " x0 x/ U) c+ Z6 }: V* l8 U( u

  53. 8 ?. e( B9 q0 w, Y/ V" l0 u' h$ G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 X6 @* z$ s3 \9 h$ g" t3 w" Y
  55. #define STATIC_SHIFT                3- ]0 U, g0 c) S
  56. #define TCINTEN_SHIFT               20
    8 }) c4 V- U2 `7 f- [, I* ]7 w' s$ ^& E
  57. #define ITCINTEN_SHIFT              21; M0 p! g" {* s1 R
  58. #define TCCHEN_SHIFT                22
    ; @9 K$ P4 m' ]$ W6 K7 c
  59. #define ITCCHEN_SHIFT               23
    , h4 P6 N7 M2 `2 `. S: `! X- u

  60. " V9 H9 @2 E# z  m6 Y4 E! v
  61. static volatile int irqraised1 = 0;$ p, _( G( {$ h# v' S) k
  62. static volatile int irqraised2 = 0;+ D$ f6 p7 M( T! f0 ?
  63. 9 u8 L% |) @1 F; a; l+ b0 R3 D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) L; q$ T, @7 _8 S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 t4 G' T  ?. t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 a$ [0 M2 Y& t

  67.   L1 R* |2 S9 X0 J4 l
  68. dma_addr_t dmaphyssrc1 = 0;
    7 ~( q& I& d* [2 ~  g" V3 S" k
  69. dma_addr_t dmaphyssrc2 = 0;" X4 q$ X2 t, ]1 s
  70. dma_addr_t dmaphysdest1 = 0;5 K( x) z! t1 ?# t6 W7 n. L
  71. dma_addr_t dmaphysdest2 = 0;
    * ^2 N5 C$ _  b$ p7 C" M
  72. 9 o+ C0 e+ I; X; _0 _9 Q$ A
  73. char *dmabufsrc1 = NULL;/ Q* _0 q! i3 o1 \6 y
  74. char *dmabufsrc2 = NULL;8 \* p- \! ?/ F+ h$ E' J$ P
  75. char *dmabufdest1 = NULL;6 j$ R3 f( w0 ~, S2 n
  76. char *dmabufdest2 = NULL;  I( h3 \% r- r5 ^( _: Q6 _

  77. 2 I; C: g& n% x! o) d) x% O
  78. static int acnt = 512;
    % r3 y4 c: R. }4 u% S9 O
  79. static int bcnt = 8;
    # H! R+ d) p0 m" {
  80. static int ccnt = 8;8 o7 W3 T. Q* a, t

  81. / H0 t% l- s; c: s( _
  82. module_param(acnt, int, S_IRUGO);1 `% ]1 y, ~1 ]
  83. module_param(bcnt, int, S_IRUGO);  }8 J: e2 `0 y+ Y/ }$ j0 u$ I& z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! D1 U, r) T# E! G& X1 Q% x2 l1 j
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 X' _  ]1 y3 @/ o9 tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 G6 b/ _5 V: v1 I" f
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ {# T* e5 z! j- L" R

1 A' z$ n2 {( y" @7 \7 X7 \2 T3 z
) ~" _' s! f( L/ V1 |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-11 06:25 , Processed in 0.042630 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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