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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  S9 W+ ~" ?8 z6 S9 \& V0 l; [. T' c
  1. [code]EDMA sample test application
    ; D, c* A" k$ F1 b, `- y
  2. /*
    ; J1 l4 ^2 g# d
  3. * edma_test.c$ q0 b4 q$ n* ^1 N( N, ]) ?
  4. *
    + d. u' t4 R# A+ w3 g, p5 C4 x
  5. * brief  EDMA3 Test Application
    ; h: ~1 A! N) V$ x( J6 I
  6. *! F; h  w# m4 F' [0 d' L
  7. *   This file contains EDMA3 Test code.9 ^, Z+ _0 u( a; ?; U3 d
  8. *. @$ ^9 S# ]9 `5 N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' i; \% l* V: G2 N0 f' Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & l1 d, w5 c2 a8 s8 j* ]
  11. *         TO CHANGE.. a. J7 H" L9 P) g/ r
  12. *) Y! l- V, I  W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ V" @" [# y2 ^9 h( [' c  J
  14. *
    ! o: u  h3 F: [6 \0 R* l
  15. * This program is free software; you can redistribute it and/or2 X3 ^0 ~! Y4 P  t+ ?0 l' t
  16. * modify it under the terms of the GNU General Public License as
      @6 t7 q* ~  _: {& L$ [" c) E8 t+ o
  17. * published by the Free Software Foundation version 2.
    , I2 l) `2 d* k! d+ q
  18. *
    " o& a/ a- `$ y$ X: S8 C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! c9 {% c! b9 E! R- Z
  20. * kind, whether express or implied; without even the implied warranty( }, D# B; D" D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% a+ N8 ?% b1 ~6 D7 W
  22. * GNU General Public License for more details.
    9 d8 H* T0 ^# \* C) E1 B2 m
  23. */% N, T) Q/ h) @: m) |- l$ Y! _
  24. & j$ }- Q7 P5 u1 s1 B
  25. #include <linux/module.h>
    2 v+ @3 S( ~9 H2 I5 {
  26. #include <linux/init.h>; {. J. ~7 T; M9 p3 G& R
  27. #include <linux/errno.h>
    7 l, p% ?6 L3 l- [" f
  28. #include <linux/types.h>
    5 s3 i: @! @! L7 @' j  g/ y
  29. #include <linux/interrupt.h>
    6 M6 q/ S' V& u7 D# B1 I+ Z: C
  30. #include <asm/io.h>
    1 L, Z: g0 q0 |
  31. #include <linux/moduleparam.h>% H; E, T% V* z  G
  32. #include <linux/sysctl.h>. P1 s9 F: y* w. i- ~2 y
  33. #include <linux/mm.h>6 f* e# |) [2 A
  34. #include <linux/dma-mapping.h>' a9 t! X5 e8 Q( G4 p% O% M
  35. ) U$ E8 L* ~  @( T( T6 ~, E
  36. #include <mach/memory.h>
    ' ^: C1 z( B" H/ ~  G: T
  37. #include <mach/hardware.h>% o6 F) }* j5 a* y
  38. #include <mach/irqs.h>  H- p$ T! {, ?2 Z2 ?
  39. #include <asm/hardware/edma.h>
    # h* j, l7 t, b+ j2 D
  40. 5 W" s8 a+ U" V8 z6 ?
  41. #undef EDMA3_DEBUG
    3 A- v+ m7 F2 ?1 B! r0 b( B$ U
  42. /*#define EDMA3_DEBUG*/
    0 t6 ?( A7 s' w0 V2 _  `
  43. * g' E; |0 s7 k) d# U
  44. #ifdef EDMA3_DEBUG
    5 b, v) m, K8 N5 p8 G5 Y( W7 V% A1 x0 K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' ~. F* u3 o6 a  j: P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 u" q+ L7 H' H  y- M4 `3 {# S' W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & g2 p& A6 s( E0 ^5 {: k
  48. #else
    ) s* X: H8 ^$ [6 k& I
  49. #define DMA_PRINTK( x... )1 ]8 \9 ~% x! B) y/ n- B% X7 t; A
  50. #define DMA_FN_IN
    , B* d2 Y! P, C0 b! [
  51. #define DMA_FN_OUT
    7 o, P7 K& A  C
  52. #endif( S$ x' P$ q; S/ Z
  53. : J1 a* g/ D( N1 F1 V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - l# I! G. {; x9 l
  55. #define STATIC_SHIFT                3
    $ E- e0 G! i6 d% E1 q4 d
  56. #define TCINTEN_SHIFT               203 E" L9 t3 R0 T/ H
  57. #define ITCINTEN_SHIFT              21
    1 z5 R  E8 k+ e7 a" ?
  58. #define TCCHEN_SHIFT                22
    * b: U+ S, \( [
  59. #define ITCCHEN_SHIFT               23
    + S8 |3 i$ t9 k+ Q; h

  60.   j( ^( W8 c# e4 q# q' C8 d* i
  61. static volatile int irqraised1 = 0;7 A- e2 [7 G& l' F3 s" F+ O- e
  62. static volatile int irqraised2 = 0;
    ; f0 U3 z6 b' V' B

  63. * L3 X0 U4 a- C& G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' u" i% Q( T! p& o9 H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" j  @/ \- {# R" M* ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: g0 R) c: L* m' D2 E

  67. ) {9 g7 i9 y5 v
  68. dma_addr_t dmaphyssrc1 = 0;/ R4 f& v& G0 O5 F" D/ {
  69. dma_addr_t dmaphyssrc2 = 0;
    7 T4 n5 [4 u* Q5 w
  70. dma_addr_t dmaphysdest1 = 0;! l' t  K) J/ F3 I: v
  71. dma_addr_t dmaphysdest2 = 0;& A/ S, O. B8 }$ K1 A

  72. - _* p  p, H  Y4 g6 {
  73. char *dmabufsrc1 = NULL;( J& {$ i  w: m8 I! _4 ]/ L
  74. char *dmabufsrc2 = NULL;9 _! [; Z& y7 M/ t) K& A7 f
  75. char *dmabufdest1 = NULL;
    . \: f) z8 d1 q+ R
  76. char *dmabufdest2 = NULL;
    % F1 e# ?7 Z3 E9 B* a* D( D( v
  77. # W* T- }; K+ p8 |8 k
  78. static int acnt = 512;
      \% [7 n8 W# N. E$ c- _0 f. a
  79. static int bcnt = 8;
    % v+ B% s( B2 Z, ^" P$ o
  80. static int ccnt = 8;
      `/ R' H* G/ t

  81. . x% X. s) S, U7 I' Z& a& G2 N
  82. module_param(acnt, int, S_IRUGO);
    # E$ y3 E" w6 Z. q
  83. module_param(bcnt, int, S_IRUGO);
    ; w' t- h* F- }/ R  q' B7 F' c
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 o/ r9 H; \# o2 J
" {) h, L9 c$ X" ^
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) b2 k# g+ \( R/ O/ w# Z* d3 c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ R' o' y! A) o1 N7 S) a3 x' J3 q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( \! }% r' m( h- b$ @% N6 }8 H

: j# Y8 j* }7 o, h4 B( S/ \+ A& Q1 K% q4 C0 E# |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-27 21:36 , Processed in 0.043023 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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