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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / M8 q: \& ?7 \0 j6 h  ~; a& O
  1. [code]EDMA sample test application
    ; |0 T8 M$ P% p1 X8 t
  2. /*1 a8 m) T& G8 n% t4 T) O
  3. * edma_test.c- ]/ Z* V8 U" I5 A+ k4 `
  4. *1 H, j( Z/ X! u% h
  5. * brief  EDMA3 Test Application
    2 y. e, f$ A  a/ [6 z
  6. *
    ( _. w+ `5 \$ o
  7. *   This file contains EDMA3 Test code.* J* O: s5 ]2 |: A; N
  8. *- Q0 V/ w& a4 \3 n9 y6 s1 z! p5 Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' y: \2 |6 \9 q8 c4 C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , l; Y8 T4 o8 |; z( H+ s
  11. *         TO CHANGE.& r$ A* `: u' `3 a' c
  12. *
    2 [% d# ~* P* I- K" H) ?' \* @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% g$ u, v. H4 F- h9 h& t
  14. *
    % A/ Q. @+ X$ v' X; N! l
  15. * This program is free software; you can redistribute it and/or1 q' A" R, G5 z! M; `
  16. * modify it under the terms of the GNU General Public License as9 v. R  L7 U7 m" L3 L" f
  17. * published by the Free Software Foundation version 2.
    9 z0 [; r! R  U5 g: N4 @* P
  18. *8 Z! v( M3 @' k; q* h1 T4 ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( }1 X5 Z- a- K
  20. * kind, whether express or implied; without even the implied warranty; \0 i3 K/ A( V. [  p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ {5 z* o3 c. Q
  22. * GNU General Public License for more details.
    : w: D9 p$ t! |$ T- d0 k
  23. */( ]) k0 B# c. I. D# T
  24.   q% f) h+ a' i5 s: q  `
  25. #include <linux/module.h>
    # W: H% }; q0 ?% b) P# a
  26. #include <linux/init.h>
    ; b' Y5 t0 N4 \
  27. #include <linux/errno.h>: B' h) f9 j4 `5 A
  28. #include <linux/types.h>
    % e7 o( p$ c3 B
  29. #include <linux/interrupt.h>
    & o: ?5 L' B& T4 @: Z9 ~3 m
  30. #include <asm/io.h>
    1 c" E1 K4 T) P3 n
  31. #include <linux/moduleparam.h># y8 T; K5 F2 u' ~- \
  32. #include <linux/sysctl.h>
    / \: r, u* G* W) s; H6 l3 v
  33. #include <linux/mm.h>4 y4 @( H6 l: e: P$ u; V
  34. #include <linux/dma-mapping.h>
    # p; X! A* ?. ]+ r9 p/ u

  35. + \. M" X$ {. |3 o
  36. #include <mach/memory.h>! W, R0 M2 \! R% f1 y0 _" ?
  37. #include <mach/hardware.h>8 B1 {! {. \- A# d# z+ Q3 I
  38. #include <mach/irqs.h>+ V: y/ Q( ~& G$ G: S4 E: N
  39. #include <asm/hardware/edma.h>
    7 I2 ]" l1 B. _, c0 \, h
  40. 0 z. D& S" W% e: |: I7 U  |6 @
  41. #undef EDMA3_DEBUG
    ! j" }) F( A# Q7 x& ?
  42. /*#define EDMA3_DEBUG*/  {9 X; Q# N7 i

  43. + T* V2 S2 t. d; n) F7 O
  44. #ifdef EDMA3_DEBUG' B& \' H5 y7 w, Y$ [! K- i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) H0 G, }- i- X& L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 v% s- N) r- S  x2 ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). S" `3 [7 z' v' }8 n* j; ]
  48. #else
      B( P' p9 H+ O4 |
  49. #define DMA_PRINTK( x... )8 d7 h0 K& S4 f1 `+ Y7 T6 j  y
  50. #define DMA_FN_IN. c/ F/ A" h0 W; J3 F; H% n
  51. #define DMA_FN_OUT* ?& J0 {! t. H: _1 W5 M" P
  52. #endif
    4 M. A  f; d9 i( @0 A% P: a6 r4 A
  53. ( A7 `% Q4 Q# m/ P& O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 ]  j/ T" g) R6 l+ [$ `
  55. #define STATIC_SHIFT                3
    # o* E% k1 a/ |: ^
  56. #define TCINTEN_SHIFT               20' o& e+ V: e  @4 K9 S( p: i
  57. #define ITCINTEN_SHIFT              21
    6 U5 A6 |, s1 j  L! k: a0 Y
  58. #define TCCHEN_SHIFT                22* V) P1 |4 ~3 c: I! o3 I) {: `
  59. #define ITCCHEN_SHIFT               23
    $ H+ U  @2 ^( h: o4 }" M0 w8 P

  60. % {6 o$ H1 b0 ^# b" E" j4 }
  61. static volatile int irqraised1 = 0;
    * s/ N- I% p' a$ D' S& P, {1 W4 `
  62. static volatile int irqraised2 = 0;( j# ]9 b, Q$ F

  63. # v5 L" }- ]$ |  Z2 r( ?1 M, G; n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " X# J; ^( A/ R) Z% X: Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, a- \8 r) q8 Z2 h+ y0 r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ A4 ~5 @7 Y# q2 n
  67. 5 R' O: h8 Y% t* t  x
  68. dma_addr_t dmaphyssrc1 = 0;! c/ E9 Y% q  g0 @+ S, ]
  69. dma_addr_t dmaphyssrc2 = 0;
    1 S+ a" w1 F) E: r! I5 h
  70. dma_addr_t dmaphysdest1 = 0;& B  x' j2 N$ j" |4 }$ w. X
  71. dma_addr_t dmaphysdest2 = 0;4 o4 w  L, O: Z. s# |
  72. 0 f  a8 K$ q) Q  a& [9 W' B/ p( V
  73. char *dmabufsrc1 = NULL;  L9 u' F) b, t  ^# O
  74. char *dmabufsrc2 = NULL;5 k6 c6 p/ w# _4 K
  75. char *dmabufdest1 = NULL;. i1 R& L6 M2 s2 _8 E9 d
  76. char *dmabufdest2 = NULL;- `& v$ h( a, O; p

  77. " v- O) B, [* f* F' I5 Y
  78. static int acnt = 512;# I7 P( h9 T  W+ v% ^/ c7 E
  79. static int bcnt = 8;6 B: Y4 m- L) n! ?3 E4 h6 p
  80. static int ccnt = 8;
    . @: G% b6 z; b# S# I
  81.   J% Q5 d/ D, w$ s
  82. module_param(acnt, int, S_IRUGO);7 ~0 @, r# A2 T0 t
  83. module_param(bcnt, int, S_IRUGO);
    3 A1 X- a0 F' s* o( M# U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 b9 J& P% ]# R6 v; G
9 M/ D- i  c8 c- y/ V4 }      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 \4 U% x1 Z9 `9 m; z! V. o9 `" w
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* ^( Y& Q1 l5 S/ K. n7 B     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* I: V6 H$ [' _' {3 h( N
( k# j6 j+ s+ J- r3 }: A

4 O* X4 t& P2 t- I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-2 03:32 , Processed in 0.037386 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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