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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 Y+ f# t4 _% V& D& {
  1. [code]EDMA sample test application
    / Q( N1 [, _( m$ t3 n6 S" A
  2. /*
    3 H$ w! g& A7 i
  3. * edma_test.c
    + \; H$ X% K2 A! ^& H/ ^
  4. *- c6 q, h+ w. R/ R/ Q
  5. * brief  EDMA3 Test Application! C; @. g4 p( B8 `5 O) [
  6. *( L& v5 o8 a5 D# g- o. x" z
  7. *   This file contains EDMA3 Test code.  y5 \7 i1 Y7 l- d5 A9 z5 \4 N
  8. *
      p, C! X; d6 H4 L8 r8 k, M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ @) m( X& C  F* U, M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 `( l. z9 n: K- A( N6 C
  11. *         TO CHANGE.
    5 H+ `7 B( }# N3 L
  12. *
    0 W- Q! [2 _5 O- v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) U! u2 ]5 @/ \- K# y7 y/ a$ x
  14. *' c% _+ `; D2 }9 D. {& V2 ^( x- x
  15. * This program is free software; you can redistribute it and/or) d" Y2 b: w; Y0 m/ o' [
  16. * modify it under the terms of the GNU General Public License as0 w4 [! u: E! E4 @. \1 C! e0 h" t
  17. * published by the Free Software Foundation version 2.
    & W7 b; ]6 B1 f$ \
  18. *
    6 ^9 i2 P% O0 d$ p! B- S/ M; e5 X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + n7 I+ G2 v7 {3 J/ b
  20. * kind, whether express or implied; without even the implied warranty
    9 n6 h4 q% G  R- {0 Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 p+ a1 A& l6 Q
  22. * GNU General Public License for more details.& _8 _% x& D. i* a
  23. */! Y% D% u+ g6 j
  24. + f+ Q& ~* w! }6 ?
  25. #include <linux/module.h>
    . ]. I3 A- E) {0 H
  26. #include <linux/init.h>
    ( C- x$ W3 x) k9 x4 l( j' u
  27. #include <linux/errno.h>
    1 o1 b2 k! j# b! c0 X4 A
  28. #include <linux/types.h>
      n7 A! m+ x; B' t
  29. #include <linux/interrupt.h>
    - N6 h: z0 x: W. s2 m. l) p; x- G1 j
  30. #include <asm/io.h>) v: |$ l9 a/ }' \/ Q: W9 H
  31. #include <linux/moduleparam.h>( l  k  l  x3 z( Z
  32. #include <linux/sysctl.h># j$ [8 J) w4 |' g; L& l
  33. #include <linux/mm.h>
    + u" u8 i6 a& A$ n
  34. #include <linux/dma-mapping.h>, a5 L* r5 y* u  i1 d7 F

  35. # K* s* K; ?% T4 n3 j/ ?' o, i- z
  36. #include <mach/memory.h>
    % X! m, K" c" d) k# E3 Z' ]6 q
  37. #include <mach/hardware.h>$ G* Q' k4 @: @" ^; f
  38. #include <mach/irqs.h>6 H5 p) M' I) [" b/ {
  39. #include <asm/hardware/edma.h>: \5 ^! D3 y0 ~

  40. " \+ p1 Y2 v) L$ B
  41. #undef EDMA3_DEBUG$ O; [; W' \3 [9 }8 N& g7 ?
  42. /*#define EDMA3_DEBUG*/+ K  c% e# O# w( s7 S  T* }! O

  43. . s" i3 }* Z. h
  44. #ifdef EDMA3_DEBUG( C2 D, r! I1 T" k* X/ I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 N* {& [  I* b: ^( K) k: `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( u: J: ~% o- h& S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 M: \, d% P# c+ h# G3 S" N9 Y
  48. #else, M: T3 @" a/ ]& ^- l# r# \
  49. #define DMA_PRINTK( x... )
    + R8 {' ~" f- A1 [0 z. g4 ?
  50. #define DMA_FN_IN
    ( A# g8 E* ~5 d6 T6 I: Y* X# {
  51. #define DMA_FN_OUT
    ) n5 p. {: M; W  y5 p; B
  52. #endif% W% [. O9 p) B. l

  53. 8 t0 Y8 L# k  N( T' k+ Q# z! f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / ?7 Y; _8 h: ]; i% j' U  J
  55. #define STATIC_SHIFT                3
    " i- ]7 m/ P8 \
  56. #define TCINTEN_SHIFT               20, R- e' e( Y& z, d9 A
  57. #define ITCINTEN_SHIFT              21
    " T9 N- K2 ]1 `
  58. #define TCCHEN_SHIFT                22
    8 ?' J1 m5 A$ U* z  [7 z
  59. #define ITCCHEN_SHIFT               23& N( R( ^; O9 {4 d
  60. , y7 V( f- l( Q' Y( S- m' a1 r
  61. static volatile int irqraised1 = 0;  y/ D+ S* Y7 P
  62. static volatile int irqraised2 = 0;
    / [; j) ~; V- V% K
  63. 5 S: R, y' D- h$ ^# ]4 \9 E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ ~; \5 }8 U3 T) F" p! S5 y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( a) p( X5 [9 j% G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - X3 C0 G1 A( P( ~5 k  g

  67. - Q. K. \: J9 H% @: B. u4 ~3 X7 ]
  68. dma_addr_t dmaphyssrc1 = 0;# [9 Y, \+ ?! D' Q% O' ~
  69. dma_addr_t dmaphyssrc2 = 0;; |) w) m/ _6 N# h2 k4 f
  70. dma_addr_t dmaphysdest1 = 0;
    ; k1 e- E; i2 m- C! T* X
  71. dma_addr_t dmaphysdest2 = 0;4 }+ O- }% t' {1 t; K, E3 V
  72. / w. }  A# N" e1 Y$ _  P
  73. char *dmabufsrc1 = NULL;. {  Z' v6 l) `. m% B: K/ P
  74. char *dmabufsrc2 = NULL;
    3 \; h/ w9 o+ ~
  75. char *dmabufdest1 = NULL;
    : o0 \. A' s/ j5 }2 ?4 u- p
  76. char *dmabufdest2 = NULL;! p0 ]9 I0 A! E2 |: Q4 ^
  77. ) I; M9 [9 r# u. f8 Y
  78. static int acnt = 512;
    / P# D/ G2 N. Y  d
  79. static int bcnt = 8;* {, j, U' v, z  [) U" Z0 M9 j
  80. static int ccnt = 8;
    & @9 U" u" x  q$ K
  81. , O/ A) y4 [' ?2 T4 M5 e( i
  82. module_param(acnt, int, S_IRUGO);
    # [( `0 R. [5 K$ y
  83. module_param(bcnt, int, S_IRUGO);4 ^& w6 J+ n6 v. @) X# Y! r
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: e4 o/ w" j' V, L4 L3 U# n- B- M2 r2 a# @( A  Y; A/ T
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 F. g6 D# L5 [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 x! R3 u3 G. W+ h  h
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; u& R$ F1 C/ Z) B$ k: N' k8 p
, V0 D& D% p3 t8 A" f% ?
/ x; O7 r6 f' U4 u' l. X4 y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-11 17:44 , Processed in 0.041516 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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