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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, W3 c6 e8 J8 \) i9 d/ }$ H# I) C
  1. [code]EDMA sample test application
    $ n) j% O6 @4 l' `3 g. r
  2. /*. A: a# [% E1 |( f) k" s3 H
  3. * edma_test.c
    # f% O6 e7 w4 }8 b! F1 p+ ?
  4. *5 l5 }  H" q* _$ Q1 N# E3 Z- b$ H
  5. * brief  EDMA3 Test Application# O" l, Z- c5 {% L5 Q
  6. *
    ( H  F6 L$ H" _  K
  7. *   This file contains EDMA3 Test code.# c: b& i$ W: [  r4 Q# \3 O& |8 l
  8. *& ^4 S- t) p6 {5 B% Y" Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 F! z7 F5 N9 G3 K$ f$ M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; A- C" j/ H1 o6 Q( F7 l8 {
  11. *         TO CHANGE.
    - U5 z- U+ h) S: G
  12. *7 v3 }' _  `1 d. A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 e7 [: C4 Q. t3 M, Q
  14. *" k5 P0 r* p4 I6 t: b1 S
  15. * This program is free software; you can redistribute it and/or; L8 W! l3 E6 [$ L- r% |
  16. * modify it under the terms of the GNU General Public License as/ e6 B7 X5 ^" U4 `; q) x6 K
  17. * published by the Free Software Foundation version 2.2 ~4 S. w" v1 ?$ m# G
  18. *
    . D! F& V7 m: d0 {; x, u  ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . |% E8 j/ H# o5 z# k
  20. * kind, whether express or implied; without even the implied warranty6 U: W" H$ g) F( v" h4 ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / w) o, d5 K' c. P" \
  22. * GNU General Public License for more details.& u9 P: G, L# S. h/ h0 l
  23. */
    # S+ I  r  l$ {% `, U1 w
  24. 6 f$ d# J& n" e
  25. #include <linux/module.h>
    . s0 L8 j7 \# S
  26. #include <linux/init.h>
    7 z2 [6 ^+ g, i* C# e$ y( E7 k
  27. #include <linux/errno.h>& h  U1 w6 B) f4 I% j$ ^8 H4 S
  28. #include <linux/types.h>2 ]* ~' ]0 F! S' [& d7 i
  29. #include <linux/interrupt.h>
    0 S+ @" ]& w6 U! F7 h
  30. #include <asm/io.h>
    ) m/ v" f6 e$ i, w4 L
  31. #include <linux/moduleparam.h>
    % f3 w/ p% b1 t1 {/ k" u) _  n
  32. #include <linux/sysctl.h>
    ( t/ B2 t8 P8 o/ F$ X+ l
  33. #include <linux/mm.h>6 {# d3 d: U) F2 E
  34. #include <linux/dma-mapping.h>
    + o  L9 I/ M4 y6 g0 ^
  35. " q2 X, Y- R, j+ b, b9 v8 {
  36. #include <mach/memory.h>* L" k$ w$ }6 ?7 k8 Z
  37. #include <mach/hardware.h>" E' |& U: ^: P& {
  38. #include <mach/irqs.h>
    " h) S( a, i1 X% J
  39. #include <asm/hardware/edma.h>
    2 x0 Y, c' Z; n6 z+ P. }* X- y9 |

  40. ; A2 _$ m  i6 ?4 L# c2 P- U
  41. #undef EDMA3_DEBUG
    ) a" k9 R1 v7 X+ i
  42. /*#define EDMA3_DEBUG*/
    / C% i3 d* f2 o* a
  43. 7 T* C" q$ T% v' F( |0 x9 @
  44. #ifdef EDMA3_DEBUG
    6 E4 V: e4 L+ ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 S9 i: [, \- N$ R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 N- `  c7 j: \  Z4 L, k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" z) q! c- y. X/ L; X
  48. #else* L9 M4 d: H3 m! V
  49. #define DMA_PRINTK( x... )/ i& Z3 B$ x0 o, ?: e$ g
  50. #define DMA_FN_IN3 g4 V, Z9 s$ t. o6 a1 g
  51. #define DMA_FN_OUT
    ) J+ V  W+ q* {3 u$ \+ Y: A% z
  52. #endif* p/ m1 u# I6 k# q5 C4 B
  53. ( |, W% ?) z& l! \. [8 T: t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 }( h  ]: M8 N! T3 o
  55. #define STATIC_SHIFT                3
    % R) e1 R" ~5 e: Z
  56. #define TCINTEN_SHIFT               20
    0 e' Y/ K" D9 a7 C' a
  57. #define ITCINTEN_SHIFT              21
    : }5 ~3 v1 H$ t$ g9 ?
  58. #define TCCHEN_SHIFT                22) S  Z) K: {4 L; z
  59. #define ITCCHEN_SHIFT               23) w1 O3 X: U5 T' m

  60. ( i9 t9 }' ^; Q6 |3 k/ s
  61. static volatile int irqraised1 = 0;& X- r3 ~9 V' |9 h  |! \6 V
  62. static volatile int irqraised2 = 0;4 S- F4 Q9 {2 c- W

  63. ( |2 k8 ^% M- N1 o) k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# j  i5 D5 U# |2 N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& a; u* D  ~0 E/ q3 \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( H6 c; ?$ D1 l' u# o5 T

  67. 6 U+ E, @- Z% \. N
  68. dma_addr_t dmaphyssrc1 = 0;+ `* K! c" a8 G
  69. dma_addr_t dmaphyssrc2 = 0;& K, \# ~; X* D) S' l4 C
  70. dma_addr_t dmaphysdest1 = 0;0 ?$ V- B# y$ |$ ]
  71. dma_addr_t dmaphysdest2 = 0;6 q4 b6 z. p5 F% @& W

  72. & d3 _: L# ^+ N! A: Q
  73. char *dmabufsrc1 = NULL;: z3 T4 }! e9 j
  74. char *dmabufsrc2 = NULL;
    & M6 T7 o8 O% B4 B+ X& N
  75. char *dmabufdest1 = NULL;
    + v8 g7 C7 q1 b  |9 I& p
  76. char *dmabufdest2 = NULL;& b9 Y2 U5 j2 Y$ U+ w+ H4 l

  77. ) _) {+ o# x+ b* \
  78. static int acnt = 512;6 n9 K6 g9 T/ |( Y
  79. static int bcnt = 8;
    2 V7 _9 r: u* v  k+ B
  80. static int ccnt = 8;: E; X& ]( d, L0 D# H& G% v
  81. - L) X* Y" ?" W0 Y7 P
  82. module_param(acnt, int, S_IRUGO);3 r- }- Q! ~9 x- i2 r6 n3 m( K
  83. module_param(bcnt, int, S_IRUGO);
    4 B( N; g# g% r5 L4 D. [
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; T! c1 r) R4 r5 W
( x, X! ~% F, f! h9 y5 D+ {      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 L: o" c7 j& qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ o6 A% L1 |& f& I4 q( h
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" w1 ~# m3 R% z) {) _8 s
5 n* m7 d) S/ Y0 s9 ?
# q3 h  i' x/ G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-21 00:32 , Processed in 0.039188 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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