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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 `' w% V8 Q4 S7 u% E" h, N1 Y
  1. [code]EDMA sample test application
    * X- B9 [5 K' `0 ?$ ?+ }
  2. /*, Y7 _7 F. f' [( z  G
  3. * edma_test.c1 Y$ N7 H0 g6 S) Y4 O- k
  4. *) q8 |/ ~4 R0 U0 ^
  5. * brief  EDMA3 Test Application1 z9 z# W# ]( ]1 Y. i, J
  6. *
    / g* p; I! M; ]/ y
  7. *   This file contains EDMA3 Test code.
    ) v! W- h6 L! h" ^1 x
  8. *
    6 E& d) M+ z: ?, f# d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- b0 B$ J: }! u) f1 N! m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! U) v9 R8 D& X' I4 f: v& f
  11. *         TO CHANGE.
    . ~3 f( S5 B0 Y: }8 `- [3 N" H1 k
  12. *
    " F  \, l. w2 |" W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" w9 }3 A' m& U$ d6 Y3 |8 F
  14. *' ^2 ]5 }" f  n& V; \) m9 e4 G
  15. * This program is free software; you can redistribute it and/or* P  J# [0 V5 M* Y: |# i8 I
  16. * modify it under the terms of the GNU General Public License as
    ' c5 k" O) u: C; E
  17. * published by the Free Software Foundation version 2.
    ! E2 y4 y7 w7 j  M- W
  18. *: G3 l' Y! j4 Q( x- V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) U3 I  W  W9 P5 E# y1 a4 |* J4 ~6 r3 p# |
  20. * kind, whether express or implied; without even the implied warranty
    0 E, T- W/ d; ]$ P0 N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 D' Y- Z) n: S9 ?% o
  22. * GNU General Public License for more details.
    / L, G+ D) Z6 Z
  23. */
    ; \8 Z  l; S( i& {8 m4 p) i
  24. ) s/ T0 T5 R9 f5 L( |, D
  25. #include <linux/module.h>
    7 M% h6 R0 u( h* B( W
  26. #include <linux/init.h>9 Z- p$ r7 s5 Y
  27. #include <linux/errno.h>
    : a- w: k0 y/ T* L
  28. #include <linux/types.h>
    8 [4 T; k. w# T) N- ?  }) p' E  j
  29. #include <linux/interrupt.h>
    % l. j. r2 x8 F% K0 L6 P
  30. #include <asm/io.h>
    - [( s2 t. Q1 `0 U- i
  31. #include <linux/moduleparam.h># Z1 X/ `1 j0 ~3 Q) `1 v( y: [
  32. #include <linux/sysctl.h>
    3 R: H+ n, V$ z5 F
  33. #include <linux/mm.h>5 O5 q6 {6 Y+ s2 `4 n2 ?, {% O
  34. #include <linux/dma-mapping.h>4 D3 }9 |* j# K6 ]
  35. ' t* s  F6 J! A) c+ j/ v
  36. #include <mach/memory.h>
    + Y8 j1 e" A" }- x! t/ ]7 J9 R
  37. #include <mach/hardware.h>. A5 v6 j3 L" ]$ ?& b5 K% t
  38. #include <mach/irqs.h>
    " x) V  U6 a& }; i0 z
  39. #include <asm/hardware/edma.h>
    7 B9 Z" m, p% \+ t- ^  O
  40. 8 E4 ]1 {5 \* A5 {' B2 {& ~9 l
  41. #undef EDMA3_DEBUG& s4 l8 D: @# U3 ?$ |$ ~
  42. /*#define EDMA3_DEBUG*/5 w" p$ c0 x; P2 }& O% ?3 }
  43. 8 i4 D2 i, u9 r: y
  44. #ifdef EDMA3_DEBUG& Y3 E. M3 e6 k, g4 d! I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . s) {6 \" _6 C: Y2 G) ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): Y+ a8 g# g0 q& A* q" N7 }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 _) S; g$ T% m: f. V
  48. #else
    2 G- j$ M- F" l3 X# E& b
  49. #define DMA_PRINTK( x... )
    - l; Y2 V3 n7 t3 y' t5 }) }
  50. #define DMA_FN_IN
    . E1 B4 Y7 U# R+ \# i
  51. #define DMA_FN_OUT: h+ S) I6 N0 ?. L
  52. #endif0 C5 k1 s% ]. X0 D$ d: N/ p" w

  53. 0 x5 E0 n/ c& f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % k; C( P. B9 v+ R( W; q" e8 K
  55. #define STATIC_SHIFT                3
    / G; I( d7 `% c$ V' X
  56. #define TCINTEN_SHIFT               20
    5 C! S( A8 N7 h, ^
  57. #define ITCINTEN_SHIFT              21" o# U. {* V- S; ^$ G8 P
  58. #define TCCHEN_SHIFT                22
    * e! @6 l: g6 @* l
  59. #define ITCCHEN_SHIFT               23
    ' ?" I# I9 Z3 a+ K0 c: Y7 M! h
  60. ) e$ K, Z' o$ q5 y
  61. static volatile int irqraised1 = 0;
    , r+ [) l5 I( Z" s) v- {
  62. static volatile int irqraised2 = 0;
    / W2 L8 U  `/ j& m& V0 {, V; A
  63. . L. S4 d# w- D; h- U( J! n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* i- u: h$ n7 ~. h2 @+ E2 ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 C9 x6 P$ _4 p4 M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. N$ L; x" g3 B4 o, h
  67. # {8 Y# H7 a9 h+ w  n! u0 b6 i
  68. dma_addr_t dmaphyssrc1 = 0;9 s7 [% w) {# g$ b
  69. dma_addr_t dmaphyssrc2 = 0;
    6 u7 H* g$ c( w+ Q: L1 L
  70. dma_addr_t dmaphysdest1 = 0;
    $ V/ v+ ~$ ]  @* n
  71. dma_addr_t dmaphysdest2 = 0;
    5 |8 E" J% ^7 L2 i' ~3 m" c) p  h
  72. / q" R& [. {! R3 V
  73. char *dmabufsrc1 = NULL;' m( m0 e8 n2 o; G; [; z. L& V
  74. char *dmabufsrc2 = NULL;" ?9 x+ v6 R  j. `
  75. char *dmabufdest1 = NULL;
    ) w! O4 j8 |; c  j! J6 ^
  76. char *dmabufdest2 = NULL;- U" w+ G4 x" s
  77. $ N, I& t; E( l  j1 T
  78. static int acnt = 512;# k6 Q% ?& M( y  d& Y. M
  79. static int bcnt = 8;
    # f, I0 w3 I2 V! t& S9 t
  80. static int ccnt = 8;
    1 Q, m: e- g6 ]" b, G1 g: K
  81. 0 M- ~/ H7 v! `# d
  82. module_param(acnt, int, S_IRUGO);
    - b$ {, M+ L- o
  83. module_param(bcnt, int, S_IRUGO);
    , I; ^! L( `5 s. X, U
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# G! Y% f8 c7 Q/ ]' u6 R8 w' L0 S4 e0 o# c
# S6 G! P% [1 |5 [/ i5 |1 d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# q2 ^# y* N7 Y0 f/ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 P/ z" |/ \* \( d( K     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* x( V6 E) [/ D* Z: W  p: B5 F; e, a* Z7 X. ]# z
9 S8 L% G, s4 ^# X9 J( |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-16 01:26 , Processed in 0.038085 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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