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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 n/ _7 `* }* @4 ]4 h0 c
  1. [code]EDMA sample test application
    8 r- j* |" [2 M8 Q
  2. /*
    $ ~1 {  {* a# t0 k0 A
  3. * edma_test.c
    - ~+ s, b$ I+ ?- ?: U
  4. *8 t; F, j4 k! y4 B" P
  5. * brief  EDMA3 Test Application
    $ D( a# Q6 r% R+ {) K$ ?
  6. *
    : P: G# _( Y% w& Y
  7. *   This file contains EDMA3 Test code.
    ( j0 O  {/ B  B) c4 L" G
  8. *
    5 _3 Z. J! r( l6 v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: f: p! D, y" m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! O) r' Z- \1 X8 J9 N( m  W& m
  11. *         TO CHANGE.
    6 e: m$ x" @, P+ h0 |
  12. *
    8 j$ \0 I& K% l8 L& J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & \5 y7 V' _% D  u9 v% b( P1 P
  14. *
    6 m! g, J( H3 D' `7 S3 p
  15. * This program is free software; you can redistribute it and/or
    ( Q" J8 i: e/ d$ U6 h- V$ E+ H% L9 F( J
  16. * modify it under the terms of the GNU General Public License as$ F$ F& Q) u! D, ?( o
  17. * published by the Free Software Foundation version 2.
    ( H. I/ u9 S; ~
  18. *
    & B5 L8 A, m7 k8 {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , f% u3 r- \. E& J/ C, o  z8 B2 X
  20. * kind, whether express or implied; without even the implied warranty
    5 J( B/ Z; w- u6 O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 |) D1 \( Y. S; k& f
  22. * GNU General Public License for more details.2 C0 c( `& ^. d2 ]* T
  23. */
    , @8 y6 h+ b2 [  a

  24. $ u. ]1 E# t2 L1 H
  25. #include <linux/module.h>
    ; {& x' T: j1 y* u
  26. #include <linux/init.h>* Y1 q; b1 D- c' J! z" k
  27. #include <linux/errno.h>
    9 p: \+ n* s7 b. R$ I
  28. #include <linux/types.h>
    5 F$ d: p$ `& @* }" s. J# ]/ m
  29. #include <linux/interrupt.h>
    - S( ^! r9 L% U
  30. #include <asm/io.h>
    ( c5 i* p6 p; N; D# X% f
  31. #include <linux/moduleparam.h>$ }+ R+ q! e6 A, y4 i( {' O$ B
  32. #include <linux/sysctl.h>) T4 u1 F$ M6 `# B- q: B& H0 E
  33. #include <linux/mm.h>! l# c9 O( P, Z9 b4 N  m/ v- g
  34. #include <linux/dma-mapping.h>3 b& l8 J7 ]; U- w- h
  35. % y- y" W, K1 k+ h5 s
  36. #include <mach/memory.h>
    ' j4 B: b3 `3 [7 j2 O7 a! o1 y
  37. #include <mach/hardware.h>
    . A7 K( G$ I' u! M- o7 c" x
  38. #include <mach/irqs.h>
    ' [8 n  d8 W! h+ `* o
  39. #include <asm/hardware/edma.h>
    # P8 N( K' V( `+ |2 v$ J+ Z1 [6 R

  40. , o1 B& B- _# |4 d$ i( H1 T
  41. #undef EDMA3_DEBUG- J2 [! Z) j2 K+ I: q; C
  42. /*#define EDMA3_DEBUG*/; a3 {- U9 U, s8 v% m9 A" M7 d% M
  43. 0 J+ m. e; S2 z" a
  44. #ifdef EDMA3_DEBUG
    , X% A, L5 C0 A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 Z2 j* k% |. h( E/ D! m# }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 g$ b5 B( M' G1 |( \2 d, Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! h3 w0 J1 u8 u  e7 ~% |
  48. #else
      h3 U. O3 g0 q/ P" \3 c: c3 H
  49. #define DMA_PRINTK( x... )5 C: T; i2 P1 g' y
  50. #define DMA_FN_IN. l7 w$ C0 B9 c$ U
  51. #define DMA_FN_OUT7 l( D& @3 B' K8 _( O8 O0 t
  52. #endif
    ' ]; r* _, S( L: ]
  53. ( q( ]& v2 w, m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , Z. s5 Q* t& h- W
  55. #define STATIC_SHIFT                3
    1 r6 a* W) _8 J2 A0 a9 D
  56. #define TCINTEN_SHIFT               20
    9 J+ z( p2 [7 n+ b% D
  57. #define ITCINTEN_SHIFT              21
    : a6 Y( A9 X9 s1 ~' e. o6 x) a
  58. #define TCCHEN_SHIFT                22
    ; C' N( V7 e7 Z9 [  U
  59. #define ITCCHEN_SHIFT               23
    , v5 u3 w' y. {& n: j2 T( I

  60. - z# }: Y- P7 D( Y( o; k3 l% O) I
  61. static volatile int irqraised1 = 0;
    0 l+ p/ T7 |& c
  62. static volatile int irqraised2 = 0;
    " v, o/ N" v7 P# l

  63. " O. l1 [: f, J: R" S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 v5 u! [* d6 M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . @! ^3 f; m: ?8 H/ W3 k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 T3 p( J8 v; ^+ N& s9 I: M

  67. ; X1 c; e+ `8 G2 X3 G0 b
  68. dma_addr_t dmaphyssrc1 = 0;
    8 \1 c; }) w5 M( h/ k1 y
  69. dma_addr_t dmaphyssrc2 = 0;" i: e5 Z6 k* F" j5 A0 b, ?1 G) N
  70. dma_addr_t dmaphysdest1 = 0;
    4 R/ A, V( B1 F2 n  [
  71. dma_addr_t dmaphysdest2 = 0;
    7 H, ?7 I8 W* ]& t/ |
  72. % n  a/ q' ^+ O0 D: @; b
  73. char *dmabufsrc1 = NULL;6 _; b$ P5 d1 M6 s' v+ V1 z
  74. char *dmabufsrc2 = NULL;; w$ f( w) N# F; ?, R
  75. char *dmabufdest1 = NULL;
    + R' T$ _" L: m/ V: E3 y1 I' J+ D: A
  76. char *dmabufdest2 = NULL;
    ( y! @4 y8 Y* D( M
  77. # U9 \: k7 D* S1 L: ^8 ^& X
  78. static int acnt = 512;
    . \5 [4 j& u- V& h( t3 R
  79. static int bcnt = 8;
    " w9 h2 i- b  M+ \- s1 S
  80. static int ccnt = 8;0 Q8 c& m1 g# U

  81. ! y* x1 Z) A5 f$ O; \
  82. module_param(acnt, int, S_IRUGO);
    4 _# s. r2 f* Y5 I
  83. module_param(bcnt, int, S_IRUGO);1 j7 i, R7 }+ c
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 p8 X1 L$ p+ g/ x& P1 M8 U
& J& O9 F5 a$ ~: T' Q. m
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" A4 x2 C; }! _  k  q$ w& _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  s' `/ c+ \8 t
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 R9 i: }( [5 G
4 ]' l( w1 z6 E
$ H( p+ {$ h7 _; R* ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-15 06:42 , Processed in 0.040366 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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