OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; s3 ^" _9 }0 p% U8 J
  1. [code]EDMA sample test application
    % o3 [& c( S. k! r; C1 d
  2. /*" s3 C" t4 h8 B/ ~
  3. * edma_test.c
    $ T' y% V7 V- @$ n  H
  4. *8 {7 R. S  X/ b7 t1 v1 T
  5. * brief  EDMA3 Test Application
    ; C* \! a3 C% \
  6. *: E5 q4 ^4 S4 M
  7. *   This file contains EDMA3 Test code.3 w+ n# s/ r  H; T0 d  c% G
  8. *8 {/ a* ^) V/ h" O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 @& _% Y" x5 v% t6 k- d2 l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 F$ F% ~$ Z+ a  |4 ^
  11. *         TO CHANGE.$ @. K2 {5 t' N+ z% o2 v# {
  12. *
    6 O- K0 m- B, C0 E& O7 \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ y' {! r; h: D& \' p+ f
  14. *4 B! O+ G+ }( D$ ?0 Y. v
  15. * This program is free software; you can redistribute it and/or9 z- E8 @& Y2 ]" ?. X) j
  16. * modify it under the terms of the GNU General Public License as' a$ Y- C% j& P" b
  17. * published by the Free Software Foundation version 2.
    " C/ g  U" t+ B, e1 U
  18. *
    . ~+ i. b( E9 O5 i  n5 _: A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  }) c/ }7 ?6 b
  20. * kind, whether express or implied; without even the implied warranty
    # K# y. N" [6 i- s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, m+ S1 H7 i' `& K. p5 [4 ^
  22. * GNU General Public License for more details.
    4 u. b8 s$ @  P4 W/ ]
  23. *// O" H* C3 {2 V, a! w& x
  24. * q6 X1 N& _! Z* a% Y
  25. #include <linux/module.h>% _3 K0 @( J4 y6 |$ D1 J
  26. #include <linux/init.h>
    ; ?" @$ Z% p. ^2 Q
  27. #include <linux/errno.h>
    . n! w0 A0 p( y5 `# G9 E* m
  28. #include <linux/types.h>+ F. z0 }; M+ L) o7 e6 I! _4 w
  29. #include <linux/interrupt.h>
    ( \- a# F) _$ M
  30. #include <asm/io.h>
    7 K1 l) h( N0 Z6 N
  31. #include <linux/moduleparam.h>
    8 e$ p$ _! b' S9 f8 |
  32. #include <linux/sysctl.h>
    8 I1 V! a/ e2 T; D. d2 e3 u
  33. #include <linux/mm.h>
    % P" p9 c: v# R/ B3 @
  34. #include <linux/dma-mapping.h>
    % T! R1 J/ H' ^9 V' G/ \: f: U. z
  35. ; a; G3 {1 A* A( O" \) ?* n
  36. #include <mach/memory.h>$ N* j( Y0 j$ O
  37. #include <mach/hardware.h>' M+ A- e/ O, m. O/ f7 m
  38. #include <mach/irqs.h>2 I6 i1 f$ q! T' Y$ \7 v
  39. #include <asm/hardware/edma.h># K* G- c: ^* h  f. A

  40. $ R" T9 d0 k, ]# o6 R
  41. #undef EDMA3_DEBUG7 z, _, U( P5 Y' y
  42. /*#define EDMA3_DEBUG*/+ c; g5 M: M; t& H# C, P
  43. ' r' L4 q0 @4 f; t$ W% U7 V
  44. #ifdef EDMA3_DEBUG7 M0 L6 [) s3 {9 r, |  v% C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 @' v* o& Y$ a) S. Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 d, x, x+ a. a0 ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 @+ K* s& [* \0 E) C0 h
  48. #else# B5 _. R8 T; y! n# X1 J6 a0 G+ p
  49. #define DMA_PRINTK( x... )6 M6 k$ p7 A* X. X+ }" U* U
  50. #define DMA_FN_IN7 ]( H; Y1 h9 w/ \" q' x6 K. k
  51. #define DMA_FN_OUT) Z) j! R2 D, U7 l/ i) J/ {+ V6 s
  52. #endif
    4 ~0 V, G$ @  r4 N4 \' a  t, P

  53. $ G, h6 U: P; M) k8 J" y# J" M8 `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! V% s( {( \" F+ j
  55. #define STATIC_SHIFT                3( l' k' ]4 M" h: f  d# N7 A, ^
  56. #define TCINTEN_SHIFT               20
    , S. W: ?' W# s; w
  57. #define ITCINTEN_SHIFT              215 h1 V- f: m. M* C; o- [
  58. #define TCCHEN_SHIFT                228 i' K7 ?$ A9 s: C. c
  59. #define ITCCHEN_SHIFT               23
    ' Y1 T4 L! m( R
  60. - K- ^, y' C7 B" E* T$ z
  61. static volatile int irqraised1 = 0;
      Y, ]! x- ?5 u( \
  62. static volatile int irqraised2 = 0;
      z: p: `% c- ]2 a
  63. ( g' p0 j( L1 `9 Y) n' s0 o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 X5 g( v9 C! U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 D9 K7 @4 V7 s2 ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      k/ B/ k3 O# z& v- k7 y% d" G

  67. . R- [+ T. s/ u) m
  68. dma_addr_t dmaphyssrc1 = 0;: `5 g" a  t! l! V: N/ v8 s5 u
  69. dma_addr_t dmaphyssrc2 = 0;
    6 ^4 ~0 D( B' o3 _/ o
  70. dma_addr_t dmaphysdest1 = 0;
    6 F: W9 |* Y6 i
  71. dma_addr_t dmaphysdest2 = 0;  J1 R9 `; Z! m5 i
  72. ( w/ M5 B8 J1 ~( p
  73. char *dmabufsrc1 = NULL;6 L1 G$ a6 w, X1 \3 X" x
  74. char *dmabufsrc2 = NULL;
    ; ?) x3 r+ ]6 ^7 n$ P5 h1 j
  75. char *dmabufdest1 = NULL;
    + J7 A" Z) l/ V9 }* \
  76. char *dmabufdest2 = NULL;
    + M& Q+ A4 O' [

  77. 9 I% N. p1 ]7 V
  78. static int acnt = 512;
      y, p, J; n' u, q1 K
  79. static int bcnt = 8;/ ?# ?3 {& P* B4 ~
  80. static int ccnt = 8;6 K9 l5 l( U0 i( }
  81. * e( W/ O2 r1 u, B. U. }' f
  82. module_param(acnt, int, S_IRUGO);8 i7 d) |" j. Z+ c* T
  83. module_param(bcnt, int, S_IRUGO);; _$ u+ x( V9 I/ c  M
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) r, {' O3 {) ~' m  {+ U* S, R
2 Y, }! r8 A, l2 f      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 s0 h/ }* J' f, O9 v9 ~2 Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ [0 Q( Q8 n* J) L7 e     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 r+ r- b$ w( C
; L! V' |% y# Q8 w
5 l& d# K; L& K2 @9 D8 ^0 }* q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-9 11:38 , Processed in 0.038565 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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