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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* u  j" R- Y" J6 k
  1. [code]EDMA sample test application9 v( c* \, L. w& |
  2. /*
    ' R" V6 X1 w+ a. c+ q
  3. * edma_test.c2 @' D: \% p# j0 |4 V& t9 O
  4. *
    8 D8 H: s1 G5 [. M9 Z* |1 c
  5. * brief  EDMA3 Test Application
    . s$ e3 f  t5 E6 p/ D& n
  6. *; Y" O3 W1 P4 j
  7. *   This file contains EDMA3 Test code.% m" i3 q' I6 G9 ?9 Z+ t
  8. *
    1 E# ^! h0 S& t( s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ G0 V7 k: [8 G6 n- ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 G: P0 d" a0 n+ ~
  11. *         TO CHANGE.6 c# A! f' z' j: V! n+ m
  12. *
      ~, r/ t5 l+ @( |0 v+ F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. X- R! u$ I( _! _2 G5 T
  14. *1 |& f& z. u% [7 A
  15. * This program is free software; you can redistribute it and/or% j! L9 h# P. e: ^$ b" H
  16. * modify it under the terms of the GNU General Public License as4 a+ h" `0 Y: p% f1 [. u3 N1 C
  17. * published by the Free Software Foundation version 2.; C. o! V9 W) a0 I- X
  18. ** D" X3 j3 F0 T+ |3 E6 \; p9 s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 A6 p0 L/ O# y5 [* ^1 ]
  20. * kind, whether express or implied; without even the implied warranty* j/ e; v# d% X8 ?$ p6 e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 A6 a' N" k5 a" l& Q
  22. * GNU General Public License for more details.9 O5 i* A- j- f4 B4 X3 A
  23. */
    4 i" A: [& k8 J  a
  24. , }3 y3 b& d( E0 P; E
  25. #include <linux/module.h>5 Y) }' C9 [% X
  26. #include <linux/init.h>+ `6 n' t6 Q  d
  27. #include <linux/errno.h>
    7 h' i" [0 B# r9 B
  28. #include <linux/types.h>
    % r4 I4 H2 a$ A2 k( ^: \/ v
  29. #include <linux/interrupt.h>
    % }: K  B; V8 ^  |: z
  30. #include <asm/io.h>% }# R8 G) j' U$ k2 ], s
  31. #include <linux/moduleparam.h>
    ! ]! T- W! D2 X0 g" U
  32. #include <linux/sysctl.h>% C) C8 O4 h  X* G' U
  33. #include <linux/mm.h>8 m4 Y8 a" [4 Q: q$ N2 n# W7 h, l
  34. #include <linux/dma-mapping.h>  Z4 `( o: y2 k  R1 d# j8 |: ?
  35. / v) N6 r9 f* R( j
  36. #include <mach/memory.h>
    # ~6 c' a. o: N) w( {- a$ D7 H
  37. #include <mach/hardware.h>  c  V* R* `7 R, ?1 Q. k6 L
  38. #include <mach/irqs.h>
    4 A  B7 a' _7 w' F3 s- E; h
  39. #include <asm/hardware/edma.h>3 Q* r! d3 x5 u- B1 I5 Y

  40. 4 B7 M, k8 `4 A9 m% m
  41. #undef EDMA3_DEBUG
    5 Z1 q. g! Q# E! p5 r% p9 B
  42. /*#define EDMA3_DEBUG*/
    ; E" F( `# K$ |) L7 Z$ F! s
  43. + {7 }9 v% d+ M: k
  44. #ifdef EDMA3_DEBUG
    % G, ]% r* G4 j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ S  W, H& u$ p' e" D5 W! D2 ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      U, V% D* {( n( D) ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % X' p( R- m$ O! o  r1 o) Y
  48. #else7 Z8 h% K7 I- j. E
  49. #define DMA_PRINTK( x... )
    - F3 Z6 {& ?) L
  50. #define DMA_FN_IN
    9 m; W* G% d, Z" m' H+ d" M
  51. #define DMA_FN_OUT0 H0 h7 \: z6 J$ h- ^' J( f
  52. #endif
    & I# n7 T. }7 F, X! {
  53. 5 Z; \; Y8 @$ E6 h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " t* h4 X* O* ?8 p% a1 D6 M: Z
  55. #define STATIC_SHIFT                3
    4 e( a% f6 |# r2 J- H
  56. #define TCINTEN_SHIFT               20! z5 f# t& p8 @& a0 M
  57. #define ITCINTEN_SHIFT              21
    " P) S$ i, P2 p/ y
  58. #define TCCHEN_SHIFT                228 S: j( S$ ~: U3 W
  59. #define ITCCHEN_SHIFT               234 V% |0 j6 h, h$ ^5 h

  60. : t* h4 J. @9 g. H1 h
  61. static volatile int irqraised1 = 0;/ f- H) `0 M) U* v. K# c$ r
  62. static volatile int irqraised2 = 0;
      |, j; k. m4 S' {: C4 j; a8 |; N: H

  63. 3 k& j: F! J, E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , L1 i- b/ }" Y6 z* |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* z; k0 [' n( O( Q- S' X# B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 q( g2 e$ C" B! }3 a: Y
  67. 7 u0 W$ R) {7 Y6 r
  68. dma_addr_t dmaphyssrc1 = 0;
    5 v5 V; A% k  x, L& c0 Z5 a
  69. dma_addr_t dmaphyssrc2 = 0;- [6 U' R3 ^4 e
  70. dma_addr_t dmaphysdest1 = 0;7 Q  @  r# A! {9 K
  71. dma_addr_t dmaphysdest2 = 0;8 m+ W" o( }- I: {

  72. ! Q' I  k9 e: Q, p1 J
  73. char *dmabufsrc1 = NULL;
    * }) `0 u+ Z- `: G
  74. char *dmabufsrc2 = NULL;0 K6 w) l5 l  G. ^+ c0 l
  75. char *dmabufdest1 = NULL;* q4 C# v1 W9 z& R- x
  76. char *dmabufdest2 = NULL;
    2 g  M3 [5 P* `: [
  77. ' ?: l3 ?3 V1 v2 T9 |
  78. static int acnt = 512;; o) w) h$ A7 `4 E$ D" S
  79. static int bcnt = 8;
    - F! Q8 ~6 r# @% i
  80. static int ccnt = 8;
    ; p% K2 a2 w- T1 K* b# s

  81. . l9 x( s, D. s& J/ z7 ]
  82. module_param(acnt, int, S_IRUGO);
    . U2 A/ }6 \; A; B' m
  83. module_param(bcnt, int, S_IRUGO);
    % p9 R: i; H5 `5 d) O" P& D0 m' V
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 n" D  L0 L: |

9 n7 m: S/ Y4 C$ F* ]; d# @      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- r9 D2 I& Y6 s  ]" |/ _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( N9 d8 q7 t) j/ C2 I0 s
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  Z* n& O5 u$ z! f. D0 F6 g
! R2 b4 v, P9 t+ c3 b
) F! m% V2 q, H6 M1 K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-10 08:31 , Processed in 0.038677 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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