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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   Y/ d6 N6 g5 U9 f
  1. [code]EDMA sample test application
    ; f3 [" C$ q% F! R/ o$ o
  2. /*
    4 h) f" }; v3 ~8 R6 @6 ^, k! T
  3. * edma_test.c) N+ T$ E1 |/ I$ \  F8 R
  4. *
    : x3 g* s  Z8 m# W) w# t
  5. * brief  EDMA3 Test Application
    , y8 c: N: M2 w; J+ z
  6. *
    6 X2 J: [# _; c" E- K
  7. *   This file contains EDMA3 Test code.
    # K/ _7 J( ?0 \
  8. *
    : e- R$ v# ~7 V3 K* `5 ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! t6 f7 L. D; @  F  \" R' d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : X+ V! q5 L5 S$ f( }) ~
  11. *         TO CHANGE.$ y. t* k; Y, }( U& ^$ G
  12. *
    6 I1 {# s/ c, v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 }+ p9 u( i9 d1 ^- F- P( M
  14. *' r0 R6 k. Z5 m4 M& u$ q2 A0 D
  15. * This program is free software; you can redistribute it and/or9 y  j' \; W% o) v; |. P
  16. * modify it under the terms of the GNU General Public License as
    / x# K) T0 T0 k
  17. * published by the Free Software Foundation version 2.
    , v% z7 G  |1 C; H
  18. *
    ) K# z9 s- g3 D5 A5 n$ F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & D: l" ?3 c2 P$ c6 g+ G! a( ~- \
  20. * kind, whether express or implied; without even the implied warranty
    - h$ x/ b/ R, i. S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. a: Q  {, I* k" s# N; O
  22. * GNU General Public License for more details.) p( s/ }2 U; N- T
  23. */
    7 L2 E. v* h& T  W* G8 S+ p
  24. # V6 ^7 y) k0 O) a& f& U
  25. #include <linux/module.h>$ k/ _3 e/ d# `0 F5 p/ m
  26. #include <linux/init.h>1 H% R. `' L# R) P/ l9 B5 h
  27. #include <linux/errno.h>8 J5 v! l6 y; W  H1 [' N$ L, e
  28. #include <linux/types.h>6 M7 s4 q5 n/ F& p) |$ u  F* A/ r
  29. #include <linux/interrupt.h>
    8 f, e6 u! w. R* g; H
  30. #include <asm/io.h>
    * p: e7 \) e' Y3 g# E- M" c/ M6 C
  31. #include <linux/moduleparam.h>
      X# g# I0 j3 T! C# D
  32. #include <linux/sysctl.h>/ [/ S2 K2 i8 N: a$ \
  33. #include <linux/mm.h>- b9 c6 N# _6 ?7 V
  34. #include <linux/dma-mapping.h>9 M* c3 z8 W8 d+ X7 s" V

  35. 3 t9 n6 ^+ Z' v3 O0 t1 L
  36. #include <mach/memory.h>
    ) _2 C; }8 ^& }7 \
  37. #include <mach/hardware.h>
    ' {7 d' G& ^& |; D3 I. h4 T# I
  38. #include <mach/irqs.h>0 V2 p, |/ s# h& w7 Z
  39. #include <asm/hardware/edma.h>9 |; L, r  {+ V) N/ f6 H/ ?6 j4 g

  40. 9 w+ A& v) i4 G- q
  41. #undef EDMA3_DEBUG
    ) Y# f. ?# U/ L  m4 B$ C) s
  42. /*#define EDMA3_DEBUG*/
    % v9 r( S7 R; }
  43. # g- N4 i. f1 D- v  a
  44. #ifdef EDMA3_DEBUG
    8 `/ Z  f" w1 \3 O2 o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " ~/ `5 j3 i" r$ U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 ?  d. a; m# l- U/ `8 h( o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - A; a' L. e7 m5 {! N
  48. #else% ]* J% g! e4 f: l" @* K
  49. #define DMA_PRINTK( x... ); c- O9 y1 P: v" W2 }: u
  50. #define DMA_FN_IN# \) [% A4 d. ?: B$ u! _3 @
  51. #define DMA_FN_OUT
    3 V6 w/ V/ @# W- @* Z+ U. X
  52. #endif" Y6 C: @0 R2 C5 d! n$ p. n/ U2 Y
  53. , R3 Q) }) ?% E. h, f# ?2 L' x+ t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " S  T9 w. i9 h$ o3 R# w
  55. #define STATIC_SHIFT                3; B0 y+ Y+ ?9 [% H$ A- G5 `
  56. #define TCINTEN_SHIFT               20: t  o: J; e7 V" w: g
  57. #define ITCINTEN_SHIFT              21
    7 o9 C3 M! f6 [
  58. #define TCCHEN_SHIFT                22
    ; Z7 `+ a7 z& m1 t* e5 [
  59. #define ITCCHEN_SHIFT               23
    * N/ f9 c: k$ {# i) U. q6 i

  60. ! z4 A) x0 m9 F1 f. J/ [6 ?
  61. static volatile int irqraised1 = 0;
    % l  N1 }" B8 G  b: e! j  `7 L
  62. static volatile int irqraised2 = 0;) a7 g+ A2 w1 ~2 M

  63. 2 J: i: {2 m$ d: l) g  X* X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( a3 F6 l/ r' `5 E3 z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 H8 ~* b* a3 i; d8 E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ C+ V, G# u; E- C  r* r) d- d
  67. 4 b7 b7 e+ m5 f2 c
  68. dma_addr_t dmaphyssrc1 = 0;
    ' A: v4 o6 c9 G1 w
  69. dma_addr_t dmaphyssrc2 = 0;
    3 v* \3 b. B! q! q" _; T+ v# {; b
  70. dma_addr_t dmaphysdest1 = 0;) S6 r( Y+ G6 N3 W7 m: S+ A
  71. dma_addr_t dmaphysdest2 = 0;
    : e  O! W; g* e

  72. 2 G: ?3 @0 E5 E$ X
  73. char *dmabufsrc1 = NULL;* X( C- H+ }. r+ G# S8 X: K" ]' w
  74. char *dmabufsrc2 = NULL;7 ^+ T5 k- h" g; g) [
  75. char *dmabufdest1 = NULL;: q& k% Z* p5 H
  76. char *dmabufdest2 = NULL;
    " N4 U6 B; g4 k. E
  77. 5 n# t- [# t, {4 ^8 E
  78. static int acnt = 512;
    . Y- I! N$ R0 n' ?5 L( Y/ t2 e+ A; F; {
  79. static int bcnt = 8;
    2 g6 N6 q5 H0 {0 D8 j# F% B' ?
  80. static int ccnt = 8;
    / N8 A0 o) S2 W; c2 E
  81. . [/ m4 C: u, c/ C
  82. module_param(acnt, int, S_IRUGO);
    : X- F) k* u2 o7 I( l# Z2 O: e
  83. module_param(bcnt, int, S_IRUGO);
    # m( q0 w* T: h3 L
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 z, y1 \! L3 Q# p- U6 p
" n  P2 s* a$ _" w' S$ C0 l, @
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) `5 N5 L1 ^$ |, u3 c/ \( k% Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& i# n. B; r7 ?# n5 Y) C     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ m; p* v- H4 O6 T2 g! `

3 f1 B+ Q$ E+ p( ?& ^6 e) c( g: ?: p+ h- _3 t. {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-11 11:04 , Processed in 0.038920 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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