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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , ]' B- ~3 o9 O- k. L
  1. [code]EDMA sample test application
    7 i4 N( w6 M) a- O% Y7 f
  2. /*
    ! B. z# W- \1 s. f) p' i
  3. * edma_test.c' a% j3 m7 _6 ?! v
  4. *
    - k0 j/ b5 E- T% B+ Z7 X1 i
  5. * brief  EDMA3 Test Application- K  i& b3 N2 z7 L
  6. *
    + g$ O( y6 o# K2 @+ w
  7. *   This file contains EDMA3 Test code.
    ' ~5 P9 ~: f+ N7 ?
  8. *; h3 z4 f4 k# I) z% G! b$ s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * y7 V! s& w; V7 j# n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! q. V8 o/ N1 X- D& x+ I
  11. *         TO CHANGE.7 f. D& Z  K; l/ ^. C0 W
  12. *
    " t4 R3 m* A3 p, L( J3 ~+ I, H9 R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 w/ L& X, B0 @$ e% d
  14. *2 N8 @/ ~+ s9 O  p7 j
  15. * This program is free software; you can redistribute it and/or  Z# D: V4 S3 @4 J8 F6 l. ]* D3 k) d
  16. * modify it under the terms of the GNU General Public License as
    6 U& M8 ]0 j/ _2 O$ _' g5 J& U
  17. * published by the Free Software Foundation version 2.2 E# K7 R/ y% d; g3 `& E
  18. *
    ; U* _. @6 h  a, s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 D! X; T* a. p+ y; n; G
  20. * kind, whether express or implied; without even the implied warranty( V1 ~! g* B  W8 J/ t% }4 e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' ^1 g. Q1 T7 d9 H. l% A
  22. * GNU General Public License for more details.
    4 w1 s! ~  V+ g
  23. */
    ) ]+ |4 s: {" C, n) u

  24. 5 u4 \" P; ?% ?% a( t9 a: F; S
  25. #include <linux/module.h>& s; E$ B. q$ G$ u
  26. #include <linux/init.h>/ |' G. @7 p& @$ w" G
  27. #include <linux/errno.h>$ c1 r  C% o' |' @2 n
  28. #include <linux/types.h>; p0 c- h; o( \- [* ]* y/ z8 q8 g
  29. #include <linux/interrupt.h>4 N+ _8 }& l2 Z: W
  30. #include <asm/io.h>. s7 }8 D: p+ {4 y' z$ P, [
  31. #include <linux/moduleparam.h>
    , m" j9 C7 G7 w. ~
  32. #include <linux/sysctl.h>  X0 B/ T1 M$ q5 p3 P
  33. #include <linux/mm.h>
    : s# ]2 X. {7 j. g+ x
  34. #include <linux/dma-mapping.h>. B' X! G- Q! Q
  35. 5 n+ I: e% {$ F, Y
  36. #include <mach/memory.h>
    0 F% T% @, H, ~1 q! ]! D7 a
  37. #include <mach/hardware.h>/ m$ a9 \! `& _
  38. #include <mach/irqs.h>( X$ }1 B" g" @6 C6 ]
  39. #include <asm/hardware/edma.h>7 ?7 K8 V, M3 K: L; a3 Z: W
  40. / u& ]: Z/ b6 B" }5 v6 M# P- e
  41. #undef EDMA3_DEBUG
    5 h- h/ q3 v$ R6 j: F! |7 ?
  42. /*#define EDMA3_DEBUG*/+ F1 Z& A; P  |. F  Y+ L' n( c
  43. 9 b/ T/ d, c( V! M5 d; b' Q
  44. #ifdef EDMA3_DEBUG
    5 U" K. S% T4 {! y, ^" @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! V( Q: p; w6 k2 k- s  ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / S! m) y/ ~) l1 p  t$ }' S1 \4 j, D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # |% K( j; [; w" `  V0 @4 Q
  48. #else
    " ?* f& z, N; {6 m- [# W
  49. #define DMA_PRINTK( x... )
    5 h6 \% H1 d0 a7 X1 G
  50. #define DMA_FN_IN0 J6 O6 T0 H3 C! `
  51. #define DMA_FN_OUT
    * Q7 l( \  u6 k  u. [" E
  52. #endif( n, e+ I1 P% Z8 r
  53. 9 T# Q- F9 O9 X( \' ~7 V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ x- m. e# U/ ]7 f: y
  55. #define STATIC_SHIFT                3
    ) f- Z7 T) S0 ^, ?
  56. #define TCINTEN_SHIFT               20% @- ~# K! u# k+ Z
  57. #define ITCINTEN_SHIFT              21  b8 k7 d, A- _3 d+ u& @
  58. #define TCCHEN_SHIFT                22
    9 Q' v* x! d1 x& l* @) s4 c0 b. v
  59. #define ITCCHEN_SHIFT               23
    # O; ~, q# x( G- t  ]9 S! ~/ I: ~

  60. & U4 C  ^3 F1 c! `+ t2 l  K
  61. static volatile int irqraised1 = 0;
    2 H" Q6 o# S  K
  62. static volatile int irqraised2 = 0;
    , t% c+ O2 \8 M! r6 Q

  63. $ f; h) u  ^- g7 o7 J: N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: \. d5 a# k0 ?+ V: b4 P: N3 l6 L0 E8 v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % M. l4 |! H; g: q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " Z4 I! i* P5 r5 R& w8 p

  67. / e( s' r% X4 g# u5 B
  68. dma_addr_t dmaphyssrc1 = 0;3 C# @# j5 \+ h6 l5 ?
  69. dma_addr_t dmaphyssrc2 = 0;) j7 d& s4 Y2 x6 W* d
  70. dma_addr_t dmaphysdest1 = 0;
    2 y  N$ B; o$ [) `9 g3 M8 ^* }
  71. dma_addr_t dmaphysdest2 = 0;3 R. s9 y0 \- `* c6 M! M2 \

  72. ! S; r+ J; Y! B! R' R/ W3 r
  73. char *dmabufsrc1 = NULL;
    ) o0 t6 [% q9 y( j; K: `
  74. char *dmabufsrc2 = NULL;# g6 ~) A6 e# P& Y  r# }, f0 \
  75. char *dmabufdest1 = NULL;
    8 ^5 B* S, q, _- P; ?; @; Z
  76. char *dmabufdest2 = NULL;$ r- M1 B) s* s& z4 a: V" s- C( l

  77. ) M) k5 g1 h( e1 O) o$ @
  78. static int acnt = 512;" E# q. U8 h- e5 V% E
  79. static int bcnt = 8;
    9 O) ~7 l, D- i2 e! e# Y8 Q* J
  80. static int ccnt = 8;& _  |( i. }' P' y4 Q4 R
  81. ! x  l& `* C5 l% j
  82. module_param(acnt, int, S_IRUGO);" O; ^) ^$ @' e0 w8 I! b# i. ?
  83. module_param(bcnt, int, S_IRUGO);$ [! s* C, L5 N+ k& Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, Q* W' e- V! W8 n/ O/ [) D3 Q
7 \, ^/ a$ a9 c: _$ e
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 w4 w; {) P+ Y9 S1 S2 d/ ^% A5 L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ d" Z+ ]: |- @/ ^' ^# k     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% {  N& f- {; t
; {* ]/ a) K! p  M: D" w
# {, |& C& V. G/ U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-27 14:06 , Processed in 0.039247 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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