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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! I( z8 I7 J6 E, ^; i! y
  1. [code]EDMA sample test application6 ]5 |" E; N2 d5 B
  2. /*) T) k# _# W" k( [- z0 t1 m: q
  3. * edma_test.c! n' ^1 X5 J3 `  J; z: V
  4. *$ d& @, e. {- T( H; U1 u4 m
  5. * brief  EDMA3 Test Application9 J7 G) ~# y' N4 m3 J, x  W; X  e9 N
  6. *, H$ y: L4 Y, T# a
  7. *   This file contains EDMA3 Test code.
    ( |) o1 L% J6 U! W' z4 S/ v
  8. *+ R: Q4 T8 ]% d9 H% y! r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" Z+ ^8 w( a8 I) B, }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 b0 d' \. A0 s! _% J1 E7 |
  11. *         TO CHANGE.9 @* ^4 R! }5 [) [
  12. *
    ' J7 H- R+ u8 D) ~/ z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* [% F3 Q# q2 Y! Y
  14. *: ?% g7 n+ @. V% a: s
  15. * This program is free software; you can redistribute it and/or3 v3 i" n( I: [
  16. * modify it under the terms of the GNU General Public License as& ?1 }! t. `; x
  17. * published by the Free Software Foundation version 2.' V' q% X1 a- K6 ?, _4 [
  18. *6 {" M6 H/ G' t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; i" h4 @# W! R# M1 e2 J
  20. * kind, whether express or implied; without even the implied warranty
    7 [4 L" S/ Z5 h# e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 m0 I9 S, `7 F; i* B
  22. * GNU General Public License for more details./ N+ M  _: G! R3 G
  23. */
    : b. H5 D1 H; \; U
  24. 1 L0 L5 K% |/ d! y5 k% Z" B
  25. #include <linux/module.h>+ w+ M" e" q0 M- p- O$ f7 P$ J
  26. #include <linux/init.h>
    6 D" R2 m4 m6 C& j
  27. #include <linux/errno.h>
    9 _+ i0 V( d; S6 e; O6 X: H
  28. #include <linux/types.h>
    2 j7 g7 y* m4 H/ a. ]
  29. #include <linux/interrupt.h>
    * Y! {) N- g4 ^, z& }. [
  30. #include <asm/io.h>
    ; O2 e- m% j; K  X
  31. #include <linux/moduleparam.h>
    ) R0 O/ M5 \8 k" u* k
  32. #include <linux/sysctl.h>
    $ L# G. j% H+ `2 m+ F8 @
  33. #include <linux/mm.h>
    + w) Z1 l7 E1 _9 N2 n
  34. #include <linux/dma-mapping.h>, h2 J+ I# |3 a# F8 E7 `
  35. , {3 X1 z' ~# G
  36. #include <mach/memory.h>& d) i1 G, s' m2 @; [4 \, m
  37. #include <mach/hardware.h>
    % J+ I4 o7 G. l, B) Q6 o
  38. #include <mach/irqs.h>
    " T+ U7 }# S& r, ?
  39. #include <asm/hardware/edma.h>
    8 B! n+ T" w" a. I& N8 A# Y& @
  40. " S% g0 b+ j2 r$ J" k% O$ `9 i
  41. #undef EDMA3_DEBUG$ e. l9 j" m1 e# F, b2 c! B& N
  42. /*#define EDMA3_DEBUG*/% n) D  W! G6 U: @2 d! m8 b
  43. 8 y9 }/ y- h, o% x- a* s- U
  44. #ifdef EDMA3_DEBUG$ ]2 d: H- X1 c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ o# Y' X, N& c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 L3 S" O$ K6 R9 f1 I1 ?% V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 p( @8 u4 M2 y6 {8 g5 i5 [: K
  48. #else0 \9 r, y0 x! z2 h. ]
  49. #define DMA_PRINTK( x... )
    $ t5 G! y/ V0 h1 b3 _& n
  50. #define DMA_FN_IN4 s+ X8 F/ K) O9 Z* @( y
  51. #define DMA_FN_OUT
    ( ?" e& M, T5 x$ G
  52. #endif. k# E& B$ e/ B) f* T. k: d

  53. 3 S% q  R, Z8 @% X. ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ k7 H6 g! \2 t& F9 `
  55. #define STATIC_SHIFT                3! s! P" e# S- O5 v* R! H9 ?4 H
  56. #define TCINTEN_SHIFT               20( x/ D6 R3 R% l" u
  57. #define ITCINTEN_SHIFT              21/ s: b3 E7 o: `: L: Y
  58. #define TCCHEN_SHIFT                22+ @7 X- g$ V8 C& ^0 E
  59. #define ITCCHEN_SHIFT               23
    / S* B, f( _2 o
  60. , ], l+ T9 U2 t
  61. static volatile int irqraised1 = 0;
    ' B* c8 L1 s  v- b) ]
  62. static volatile int irqraised2 = 0;
    & j$ Y; K% A; r% s5 U
  63. . `$ L. L$ ^9 C1 c4 A: x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) {7 }* K  Q2 p) v' {, k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 a9 t" g- p0 |5 `7 R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - S+ m3 @6 R7 O2 Z

  67. ; D6 |  F& q* h
  68. dma_addr_t dmaphyssrc1 = 0;3 q3 ~6 }, `. Q' K" L/ x
  69. dma_addr_t dmaphyssrc2 = 0;
    6 V. B1 q# `2 z3 n
  70. dma_addr_t dmaphysdest1 = 0;
    0 d, ~9 J3 x- f( q( [* B) x
  71. dma_addr_t dmaphysdest2 = 0;
    & m, D9 X# C( G* P- _1 k0 H

  72. ( Q! X& b/ G  U6 C5 x5 l9 V4 M
  73. char *dmabufsrc1 = NULL;
    & R  q5 t0 g: V1 D4 A
  74. char *dmabufsrc2 = NULL;, ?" W  X8 `, B  L. S7 v
  75. char *dmabufdest1 = NULL;
    # ~+ z7 ]. q0 e4 e" J: X
  76. char *dmabufdest2 = NULL;9 F! c9 M/ T, \: P3 E7 o5 c( l

  77. ' g# p9 {; v9 ]1 {( f5 _
  78. static int acnt = 512;
    7 L  U' ^; O9 H! K
  79. static int bcnt = 8;
    ) a% `  o0 f- t* l- t
  80. static int ccnt = 8;  W% T& N3 J5 U7 b9 i5 h3 t2 N
  81. + T6 M1 `( ]6 U! `9 _
  82. module_param(acnt, int, S_IRUGO);
    / |8 k3 e* P1 X: W
  83. module_param(bcnt, int, S_IRUGO);9 O! Q# L3 m& Z" I: i
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; i/ R$ g" W6 ]+ \8 @2 @0 v# W1 n
* s$ m+ T$ Y: u+ d1 D      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 P, Q- v" D% T; darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" m2 J: v0 `# c, O' z, J4 `4 E- t  U
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 q& n* h6 F4 O9 C1 @; ]
  w6 v- j$ b! Q! ^$ K: ^' I  U

+ Z+ v3 J: D0 o( j* L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-30 08:27 , Processed in 0.041112 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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