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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : t8 r3 o' ?0 d; N9 L* g9 i& j
  1. [code]EDMA sample test application
    8 _3 R. A2 n& r" |- r/ G
  2. /*, d1 s- L* D% [  T4 y
  3. * edma_test.c- |- R! C+ ?' A) A  h
  4. *
    ) q1 f# @4 ?5 `- a. a
  5. * brief  EDMA3 Test Application( H. F" Z! ^) \
  6. *, `1 N2 q# Z9 C+ Z( V4 m1 a: |0 D- Y
  7. *   This file contains EDMA3 Test code.3 {! \# L6 E& H, b) K) F
  8. *& N6 ^) p" n5 a4 t- }7 v7 @2 }+ P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. r+ d; x  p  ~+ E4 V2 }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; t- n* V2 H6 I$ l! B4 V7 @+ H7 \7 \
  11. *         TO CHANGE.! D# e$ s! \' b/ B  w
  12. *
      q4 Q. x- |8 `+ F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : r. c( E) I2 Q7 d6 J( l
  14. *
    / d! N- m% b! y# T, d
  15. * This program is free software; you can redistribute it and/or
    ( b8 F+ F# M, J' u. L6 X
  16. * modify it under the terms of the GNU General Public License as5 Z+ w+ s8 ~$ c( G
  17. * published by the Free Software Foundation version 2.
    4 w! y' i0 z- [0 A- F; M- |3 k
  18. *
    2 y$ w. \3 N1 r# V- L% F- [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 T3 j0 T$ m' Y- m. }* ~+ U+ Y
  20. * kind, whether express or implied; without even the implied warranty
    : N9 r$ j! ?' l6 i! T( k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 k6 [8 ]3 C2 o/ M9 a! r2 F. u
  22. * GNU General Public License for more details.# |0 C( a) q' q- V! C* p3 F7 ^$ P
  23. */' ^" T6 A/ ]' R& n9 }5 r+ G

  24. 6 |. o' o0 e: V3 i" ^$ E
  25. #include <linux/module.h>; L) @" h% j) ~6 }$ ~- A
  26. #include <linux/init.h>
    * x% Y3 R) b5 R. ^: ]
  27. #include <linux/errno.h>
    * E: h* \2 S* S9 |
  28. #include <linux/types.h>; f" l" L) @6 N. s
  29. #include <linux/interrupt.h>! c% p' Y( h! u: K2 M
  30. #include <asm/io.h>( T# |5 A& X2 ?. j( l5 F
  31. #include <linux/moduleparam.h>
    ! Z. P( c% g2 c% c# V/ S. `
  32. #include <linux/sysctl.h>
    , f3 A7 a9 u( O
  33. #include <linux/mm.h>) U8 @6 h* U1 w" ]0 O
  34. #include <linux/dma-mapping.h>. X" S, r% |) A) q, G6 Q
  35. % W# `# @* ~+ ~0 M4 X( Z) b
  36. #include <mach/memory.h>
    4 w6 i0 k! k$ T0 {6 z2 y
  37. #include <mach/hardware.h>  @& u. Z( _. u6 _
  38. #include <mach/irqs.h>
    1 p9 V% C/ K  [
  39. #include <asm/hardware/edma.h>" b4 w) z5 D3 ^/ b
  40. : L- M# o2 W$ {9 O0 {7 Q. |
  41. #undef EDMA3_DEBUG
    ; l" q# c1 H/ ]$ i7 E
  42. /*#define EDMA3_DEBUG*/+ T% V, G* w. ?  I* Z! p* X

  43. ; \( ?' \/ [8 d+ Y2 l
  44. #ifdef EDMA3_DEBUG
    % Q, q/ O6 Q% h' b/ ^) g& h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 `, _" M0 h" q. h+ c/ J9 I" P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 w  i# a% b% r' `' E* E( R# G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 D! G# @) N6 z
  48. #else
    6 N0 e5 d- ]2 }& S) T% l
  49. #define DMA_PRINTK( x... )
    ! V9 H7 T  d6 X( m. ^$ }# _
  50. #define DMA_FN_IN
    . ?2 Z' F* G/ N" m. D7 Y9 T- Y
  51. #define DMA_FN_OUT
    3 Y3 q/ h1 o: w4 m! q# O2 ]
  52. #endif
    , l+ J. `; [: O! C
  53. ! y. |+ N) h  r: m2 `. _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 c; |- ?8 s6 M9 ~( z( v/ n# t
  55. #define STATIC_SHIFT                3: a- u) k" o4 Y
  56. #define TCINTEN_SHIFT               20
    0 t* F1 G: Q( p5 F4 M" p# w
  57. #define ITCINTEN_SHIFT              21
    , n+ ~, ]; G3 T- M, w7 L
  58. #define TCCHEN_SHIFT                22
    ' S% ^; F  x: ~  `; F: [2 I
  59. #define ITCCHEN_SHIFT               235 ?/ W2 g2 Y1 S/ X

  60. ; Z4 S3 }2 V0 [& G5 l" k3 x( b
  61. static volatile int irqraised1 = 0;
    4 G1 O2 b, M' ^
  62. static volatile int irqraised2 = 0;4 J5 l6 K, }9 i  I/ S

  63. ! [$ s, C0 t0 Z' k  v3 L, d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 S7 q4 m" O; v/ C: W9 r" K9 c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 n( s# Q6 q# F+ o7 d( ~1 s7 e2 O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" j* ^1 C) |% e% E" M7 l+ V& G

  67. ' k+ u/ I% J; T3 ~. {* N' |6 }9 k
  68. dma_addr_t dmaphyssrc1 = 0;* u& }" C* T) X. H
  69. dma_addr_t dmaphyssrc2 = 0;6 @; p& q& p5 B( V
  70. dma_addr_t dmaphysdest1 = 0;
    % Y' W; h" l+ s) E" [+ ]
  71. dma_addr_t dmaphysdest2 = 0;
    8 b; |/ Y1 F3 z7 ]! y9 @" \4 ~- _
  72. 0 w8 H7 V6 ?3 u: U, i* d% d! a1 B
  73. char *dmabufsrc1 = NULL;+ |. m1 o* p% v
  74. char *dmabufsrc2 = NULL;0 ]$ A: Y# n8 {6 T9 n5 R
  75. char *dmabufdest1 = NULL;+ F* n% s/ m) G6 \! Y4 ^  [
  76. char *dmabufdest2 = NULL;3 d# h! K% e# j& r1 z0 }3 Q' k& y9 C
  77. / }: \5 f+ f4 b5 G1 M
  78. static int acnt = 512;) q* O7 v+ Q4 x4 m) D
  79. static int bcnt = 8;6 s8 K2 P: R6 j; l9 ~6 r
  80. static int ccnt = 8;# Y2 F5 R+ W- S9 E
  81. ! C. T/ ~& C+ q5 O
  82. module_param(acnt, int, S_IRUGO);
    + h1 v- W# L; \3 N) g! T% o: q: a
  83. module_param(bcnt, int, S_IRUGO);
    8 k/ X3 }8 Y+ }
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 h6 w7 M  u9 `2 R2 H- @/ Q4 f4 `* |
1 W& ^% S  f' \0 V# [) ]* }* _' U
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- h* ~) N' m) x  [$ N+ x; ~% o4 a# uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) t1 o, Z5 w3 m" a; J4 q& `# Z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' }4 D1 e: x2 ?" k  c9 n
1 W9 ~# f! C! r, K8 x; r. d

" R3 m1 U$ @) P6 r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-23 00:47 , Processed in 0.040492 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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