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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 d1 w" Z8 A1 a( @0 X
  1. [code]EDMA sample test application
    0 Y! D$ f  V& E. R) J2 |/ N
  2. /*
    : c- J- y" h% t4 I; @# |2 O
  3. * edma_test.c
    9 k# U$ y  X; ^2 V
  4. *
    9 i: s' ~6 V# `9 G4 u
  5. * brief  EDMA3 Test Application
    ; C* \/ e) }$ `) c
  6. */ G  E- n! E; U  t" U$ |( }. i
  7. *   This file contains EDMA3 Test code.; L5 c9 N: @) h. ?3 i$ G
  8. *1 d$ E, M) w" X. w  {' O5 `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ f. {: J# v7 o( `/ M+ Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 k4 Y$ X1 R! H; I; l4 F" q! N6 J
  11. *         TO CHANGE.5 j, I5 u7 f- Y2 \
  12. *1 C) z. A$ Z' a& U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 K  Z9 e. |' ?6 I
  14. *2 _( H' K+ o# v$ x' P* Z+ L$ _
  15. * This program is free software; you can redistribute it and/or7 d! l( A9 T4 D! G" s
  16. * modify it under the terms of the GNU General Public License as
    ; g- n2 W2 d3 d* t% W0 W8 i
  17. * published by the Free Software Foundation version 2.! s! [8 X2 k( n) f1 d  ]: t6 o
  18. *: d8 o. e/ J8 i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 d$ F$ p# \5 \% ^/ L
  20. * kind, whether express or implied; without even the implied warranty
    & j! _) w5 v9 Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 S. ]0 m" u4 ~9 i2 K
  22. * GNU General Public License for more details.: t  m; u9 @* B) `% j
  23. */
    7 X1 m6 s+ K' g% L+ Y$ i; M; N" P

  24. % `/ ?7 p! [3 q7 {) Z
  25. #include <linux/module.h>, T! G6 G3 {  W) W& B% U: o
  26. #include <linux/init.h>
    & P$ [$ q. \) E# f: @# z- Z
  27. #include <linux/errno.h>
    * P$ }; o4 F0 L" ?; s4 T
  28. #include <linux/types.h>  O( H/ J1 _6 ^; z0 g4 N
  29. #include <linux/interrupt.h>) G% v: Z5 T$ ^% J
  30. #include <asm/io.h>
    & n5 B9 u  P' `; E8 Q) P: a
  31. #include <linux/moduleparam.h>$ x' a5 O3 C# ~( ?% a
  32. #include <linux/sysctl.h>
    + D) V+ o: N+ E5 x5 W) i& M) e
  33. #include <linux/mm.h>0 F; z* f( u! t1 C% v* l7 ~
  34. #include <linux/dma-mapping.h>8 z7 H. E- k6 e! B4 n/ W5 M

  35. ) I& X& c: g( {% ]% D" f
  36. #include <mach/memory.h>+ j, E* d, y! V0 y" m7 s* l
  37. #include <mach/hardware.h>- n4 S" r4 p& t% K" {( S+ g
  38. #include <mach/irqs.h>
    ( Q! O" \$ {& j: h
  39. #include <asm/hardware/edma.h>
    & C, \4 M8 H# H* h. y
  40. : m- f, M! n4 h8 b, J% H; a
  41. #undef EDMA3_DEBUG
    8 E7 Q: z$ T: F# Y" M# a8 }5 o3 h
  42. /*#define EDMA3_DEBUG*/0 f, Z8 p2 A) }+ p

  43. : T1 m0 Y6 ?4 F' }6 Q
  44. #ifdef EDMA3_DEBUG+ p+ l3 p  A3 t. c$ `) B! g. u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); r4 x$ t) R) I+ f1 a! d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 h6 b! T) Y' d2 e& @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - `! g! w$ f; F$ l2 G" k0 o# H
  48. #else, ]! W% q9 _) T; z* r
  49. #define DMA_PRINTK( x... ). F  f) w8 z9 ^
  50. #define DMA_FN_IN
    6 ?! r: D" x) [6 s; u4 D  `
  51. #define DMA_FN_OUT
    * b( z% K5 \3 O; o
  52. #endif
    & E1 `& h3 K, v' J' p( h
  53. 8 y/ N" {. U7 D$ _& h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , C, q7 A+ {, Y8 ], T5 `! G
  55. #define STATIC_SHIFT                3
    / u$ T: g$ t( ^" m6 T
  56. #define TCINTEN_SHIFT               20
    ! ^3 }0 I' q5 d. {& p
  57. #define ITCINTEN_SHIFT              21% h1 z+ C, r' L( z
  58. #define TCCHEN_SHIFT                22: \% z6 g- L% W8 m- k
  59. #define ITCCHEN_SHIFT               238 I, P& ~- c) p4 x

  60. ' j& L; G4 d! T1 H
  61. static volatile int irqraised1 = 0;# `; _8 H5 W" M* Y$ B# q7 m7 _
  62. static volatile int irqraised2 = 0;
    6 X/ p; V/ |3 z9 l+ G# y

  63.   P) [, v) U3 G; @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( p+ l5 i5 k2 R2 N  j1 s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 B% y7 g* o' O. k0 M4 ]: l3 ]9 Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 k7 M3 s8 B/ ]* `- J! T0 @
  67. 6 e$ h- t8 i9 F. G6 }" B/ {9 \
  68. dma_addr_t dmaphyssrc1 = 0;3 v0 r. k4 s/ o& q. h+ C) W
  69. dma_addr_t dmaphyssrc2 = 0;8 G' w/ X/ C3 Z/ ~( }
  70. dma_addr_t dmaphysdest1 = 0;& V$ Y2 p, x2 l8 P
  71. dma_addr_t dmaphysdest2 = 0;
    , T  w, {/ v. G& P0 z
  72. 7 D) _! e, C! a: D- W
  73. char *dmabufsrc1 = NULL;/ K0 U2 z8 j8 h; L8 O, R8 Q- T
  74. char *dmabufsrc2 = NULL;. o" \3 q2 L8 P4 h) L; S" p
  75. char *dmabufdest1 = NULL;
    . A4 H! U0 c4 P1 n1 h! m
  76. char *dmabufdest2 = NULL;' Y0 p$ t6 ^. w' s
  77. % P7 C$ ]. R0 i; L% {7 Z
  78. static int acnt = 512;9 Q2 Y0 n0 G' y  w
  79. static int bcnt = 8;5 V$ h# \* Z; [2 ]/ J  g7 f: A
  80. static int ccnt = 8;
    0 n  p/ B3 n1 u6 @

  81. * L1 `# b/ e: ?# H, r+ J: l2 q& V
  82. module_param(acnt, int, S_IRUGO);
    ( f% q$ K1 O, C9 E/ f; W
  83. module_param(bcnt, int, S_IRUGO);$ T8 d3 _  _8 K% {9 V
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 V" F, Z7 {: v
4 Z: d0 |- {- N+ L& e4 v7 \! y7 v      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 a" Y6 w5 w, 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 M# `: Y6 U$ ]0 H9 g; X     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 V2 J) f& d6 p, _
( B: A' j. s" q, e. b: `- x
3 e7 |# K. u/ L( l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-29 06:40 , Processed in 0.039440 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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