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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 y! T7 l  N1 B3 i
  1. [code]EDMA sample test application* b! N( x- A2 S* t) C
  2. /*
    3 D) V$ O$ b4 [
  3. * edma_test.c3 `' @1 U" R. b, v" L
  4. *& M8 F% k' A, g
  5. * brief  EDMA3 Test Application
    7 U& |; m" A3 M0 q, q0 Z: F# e
  6. *! J$ W! @+ s& _2 u
  7. *   This file contains EDMA3 Test code.
    - \2 o  ]& x6 p. E+ V; L
  8. *6 F% i7 \3 o4 f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 Y9 e5 l& D' B; s6 r, S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 m. E) X! s5 O! G. v
  11. *         TO CHANGE./ [8 p/ K6 s" L+ L
  12. *
    ( `$ ~1 y0 G: X4 a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 N4 x7 J1 A" I
  14. *
    & T& r7 N& U6 t; Q
  15. * This program is free software; you can redistribute it and/or; u% ~! R1 |7 [6 r
  16. * modify it under the terms of the GNU General Public License as
    3 U3 A0 Z! e3 I+ ~* L* L/ Q
  17. * published by the Free Software Foundation version 2.& b; Y  o% o8 h8 `7 }6 `2 L
  18. *+ u: D. O) E: N# |& x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% E0 Z, T- K2 [; Y5 W8 I
  20. * kind, whether express or implied; without even the implied warranty
    2 \) ~9 r  |; a; h5 F7 P; @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 V: `7 _* h* T+ y# M2 F# i
  22. * GNU General Public License for more details.) ?! {) K8 h: ?2 ^) M# w0 e; Q
  23. */- {# d$ h- Q3 O% h+ A2 c

  24. 5 z3 {2 |! t5 b  Q; N
  25. #include <linux/module.h>: h; v8 V. n7 }' k& W5 t: B
  26. #include <linux/init.h>
    # m  ]  f1 \/ A
  27. #include <linux/errno.h>4 S6 S# ~! L7 Y7 f0 L
  28. #include <linux/types.h>" z- t' `' S- e) z7 D6 @' _* c( c
  29. #include <linux/interrupt.h>7 y* u1 b, B8 j$ h
  30. #include <asm/io.h>: y& A+ A( M% p: w2 V) E
  31. #include <linux/moduleparam.h>+ w2 A4 K' @- W, w( o2 ~" x. Z  _7 m
  32. #include <linux/sysctl.h>
    0 h: ~) d3 d# {* m: I
  33. #include <linux/mm.h>
    2 ^$ ]2 Q  U( N+ H
  34. #include <linux/dma-mapping.h>
    ! z8 j. E' L8 c5 S
  35. ; s, ]6 s, P. \( t) s
  36. #include <mach/memory.h>' K  C5 u' l$ E! E3 o# e2 @* p
  37. #include <mach/hardware.h>
    / \: U$ U) c& h
  38. #include <mach/irqs.h>% w5 F7 l# E) K: Z; k
  39. #include <asm/hardware/edma.h>9 G2 b1 a& o' O" f% k: M+ h

  40. 3 f$ T4 n) c) |- T7 ~2 c
  41. #undef EDMA3_DEBUG
    - M* B2 ~" q6 X6 D; V/ F+ d
  42. /*#define EDMA3_DEBUG*/- W$ E( N; G5 i$ A) b5 y
  43. ! d, Q7 ]' Y  }
  44. #ifdef EDMA3_DEBUG' W; y8 w" u8 L; e6 |9 h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ N  u+ i& w( ]" T  a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* N2 k8 t$ Y# Q, }& `; q3 t! M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 ]! x) T" C4 B2 ~& v5 s
  48. #else
    0 s& l0 \7 S* g
  49. #define DMA_PRINTK( x... )
    / p0 j6 B2 T0 n% i% ]' z
  50. #define DMA_FN_IN
    ; @" Q+ |: S. K
  51. #define DMA_FN_OUT- N, _" W6 n/ I) j* b0 z
  52. #endif
      O2 K" Q4 T# b& ?  o! o
  53. : ~' `5 |9 j9 V; u1 g; x) F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * Q) j7 e) H4 Z$ X' I7 Z
  55. #define STATIC_SHIFT                3
    5 r# t7 k, P: G% @
  56. #define TCINTEN_SHIFT               20/ W* y: ^, M$ K" Z
  57. #define ITCINTEN_SHIFT              216 D6 s$ K. z1 u8 J) a6 ]
  58. #define TCCHEN_SHIFT                22
    ' G* W5 v  g! z* s2 N0 X
  59. #define ITCCHEN_SHIFT               23- S% Q) Y6 J7 L! H" M6 x& m

  60. ; O5 _# j* c; ?# N% W8 p
  61. static volatile int irqraised1 = 0;  V( Y* f# D7 y9 V- U8 L% V
  62. static volatile int irqraised2 = 0;
    / V, q% c; o2 T8 Y/ a

  63. ! H: Y; R% F0 c! W3 E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; u, G/ s! v2 Z- v# ~( g" |+ L5 W- y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 [- p) O# R! ~, g$ x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 k/ R& B$ [. H6 @: r$ O

  67. " b5 E- r8 F4 f# {  T7 s8 Z9 I! O
  68. dma_addr_t dmaphyssrc1 = 0;
    ' w4 O* o0 P  p. s! T
  69. dma_addr_t dmaphyssrc2 = 0;* G$ y$ `; Y6 t9 L9 R- |
  70. dma_addr_t dmaphysdest1 = 0;' _) m8 }" h- u) K  H$ t7 J+ x) T5 h
  71. dma_addr_t dmaphysdest2 = 0;' `% t8 p, v( `, l
  72. ' m) ^1 {0 k$ A0 ?. r+ v# q* A' \
  73. char *dmabufsrc1 = NULL;
    2 A( r& N! p6 F- O% z
  74. char *dmabufsrc2 = NULL;
    ) H7 F* G0 z/ w
  75. char *dmabufdest1 = NULL;. R6 F# [1 A' [2 o. ~
  76. char *dmabufdest2 = NULL;- [; F3 a& H; u# z2 g' t+ N8 t' X1 I
  77. 0 I/ P" W- ~6 q5 S
  78. static int acnt = 512;
    4 F- {, j1 E5 |) X% N* K% X
  79. static int bcnt = 8;
    % G6 f4 Z* }, }/ ^
  80. static int ccnt = 8;. q6 `0 D) x0 z$ U

  81. # z3 v9 N5 G- Z4 l! v
  82. module_param(acnt, int, S_IRUGO);7 h" x+ Q' ]) ^/ ]
  83. module_param(bcnt, int, S_IRUGO);
    & B2 ?3 h) K- m1 `& z8 B; ?8 u/ e
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: g2 ?. ?* ]  i& t* N; R$ C. b6 n+ Q& Q8 ^: i7 `7 Q) `5 I
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ }) }1 ~5 g, M) w% f# c2 Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; O2 o+ D9 l+ ^( |8 J) g' Z/ X, R5 ?
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 ^- m! p  u* B5 ]' h

0 U$ M! {/ C- ?" k. U0 G; C8 @- r4 w5 \& l6 q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-20 16:05 , Processed in 0.040069 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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