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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. ^* A5 `! V5 k' o, b! \
  1. [code]EDMA sample test application
    3 l3 o; U. [3 [2 [
  2. /*' p) J! h3 E. z& ^
  3. * edma_test.c
    : t3 g( H7 D; D, i- n% b
  4. *
    ! b5 \/ P, D* `" ]# f2 e% w
  5. * brief  EDMA3 Test Application
    ! F5 F# t5 I9 T% Z+ q5 U% I2 q2 k8 p
  6. *
    ) t3 Z. |0 A+ b! g/ T+ X3 r- P
  7. *   This file contains EDMA3 Test code.
    9 d3 O4 E. g$ O  s
  8. */ x( `1 V: ?) |+ c) h- n4 p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 G# w7 v4 W: `4 \: f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 z% @) ]. W0 b5 e4 A5 P9 R9 b
  11. *         TO CHANGE.3 K! U$ ^! L) y7 Z1 q+ J, F
  12. *8 f0 e& C) {% o: ^* v+ D" a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( @' D2 G6 g6 |' X
  14. *
    9 q0 k8 V4 i4 S* j' l( U& z6 N
  15. * This program is free software; you can redistribute it and/or: k, w% {7 {7 U- Q
  16. * modify it under the terms of the GNU General Public License as
    ( j# s" K: }+ o% k
  17. * published by the Free Software Foundation version 2.
    . p% l: E* ?" Z
  18. *
    & n+ _" I1 \2 p. m' w$ B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! S% \$ f$ ~3 @% V$ G3 Z
  20. * kind, whether express or implied; without even the implied warranty6 s' K4 n+ M4 S* e! r1 C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 T' `3 o/ _  `. o
  22. * GNU General Public License for more details.
    5 P2 [2 N% T7 a& d: H
  23. */& E5 j2 c1 v! D: K

  24. 6 o8 S* ^5 m& J5 L1 d+ o
  25. #include <linux/module.h>
    2 ^) ]1 L! Y/ A
  26. #include <linux/init.h>
    : N: v8 D; j& _) u! Y1 w" |" N
  27. #include <linux/errno.h>
    ' Z- W; v6 L& I( D* t
  28. #include <linux/types.h>
    . `( ]' `' ?) q+ Y
  29. #include <linux/interrupt.h># m3 N+ d' t& U
  30. #include <asm/io.h>8 m( f% _& G5 s6 |. i# @$ d7 C
  31. #include <linux/moduleparam.h>
    4 T  |$ v8 g2 N; g
  32. #include <linux/sysctl.h>
    $ D# w+ _/ A: E* ]# P
  33. #include <linux/mm.h>
    7 L, u9 N4 k* n: }( C
  34. #include <linux/dma-mapping.h>! O  @: F, M+ Z4 c+ y* r

  35. % h; ~' |5 |# v* L. U$ ?8 z. S
  36. #include <mach/memory.h>
    + P6 s) C, M+ ?
  37. #include <mach/hardware.h>- s- d& h. X4 C( T9 ^2 ~6 @
  38. #include <mach/irqs.h>) d$ J9 Z+ d& d+ |9 w
  39. #include <asm/hardware/edma.h>, V+ F6 J8 G% h, y- c1 P
  40. 8 J  ?& r9 K! O, D2 H; S/ |
  41. #undef EDMA3_DEBUG& T! W0 ?) e$ A, E! |  Y" L7 u
  42. /*#define EDMA3_DEBUG*/- B3 l8 z, L+ [7 T6 N$ h
  43. 0 \5 h3 O* \8 u* p  E/ T* {
  44. #ifdef EDMA3_DEBUG
    8 m  \8 Z3 o' q! w2 N* w1 q3 \4 `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  |% t( r' j) r' K$ w  `% u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' y6 Q. [$ k& v( r9 L4 i  ]+ B; Y6 I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 P3 z7 j- H" G, ]! K9 I/ b
  48. #else0 F$ M0 ]; T. X, d* J* K8 ?( c
  49. #define DMA_PRINTK( x... )5 ]0 a& U) _# ]# e% y: W
  50. #define DMA_FN_IN
    6 P5 C2 _( [$ h. t0 s! f
  51. #define DMA_FN_OUT
    - k: i- h! \* D' \; J4 _
  52. #endif1 k1 V5 _5 a5 K8 F7 ^& ?

  53. 0 m/ Z# `" Q: c. w. _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; @7 X- S  `, x' y$ E1 I! t/ D4 e
  55. #define STATIC_SHIFT                3
    ) [2 X# r1 q: [2 k% z* ^
  56. #define TCINTEN_SHIFT               20/ B# x, {" S; `* }8 }
  57. #define ITCINTEN_SHIFT              21  Z& N; o& o' O% L
  58. #define TCCHEN_SHIFT                22
    6 f$ W/ O2 m$ J/ J* V5 }3 V6 u5 Y
  59. #define ITCCHEN_SHIFT               23
    . {7 n$ U1 A. K9 O
  60. ; q) }! H3 V' p, t- k# z5 k
  61. static volatile int irqraised1 = 0;
    0 [  ?! O% |- f+ r& z6 i
  62. static volatile int irqraised2 = 0;9 c, G2 c1 s% U( [, `' J% M
  63. 2 p" l; ]/ Q, y4 j; M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. ?, U( g  Z9 h! B8 C1 X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- N! M# Z( R! ]: K: Y  r- G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# W  g; f3 g0 u* P4 O$ P

  67. 3 B. B) W  q  o0 s! n2 v7 u
  68. dma_addr_t dmaphyssrc1 = 0;
    / F7 G' U. O# E' J
  69. dma_addr_t dmaphyssrc2 = 0;0 D  p  B0 [1 ^& N' j( k3 V
  70. dma_addr_t dmaphysdest1 = 0;
    % g/ R0 M; ]; X  u
  71. dma_addr_t dmaphysdest2 = 0;
    % r, |: x) |  {. C

  72. $ v1 f8 F' F0 U1 m
  73. char *dmabufsrc1 = NULL;
    " ^8 p) N( Y" i
  74. char *dmabufsrc2 = NULL;
    ( D8 Z% g" v. s6 O1 q5 C2 o6 _
  75. char *dmabufdest1 = NULL;' |5 u, v: r- x/ Q4 b7 T- j2 V. y) F
  76. char *dmabufdest2 = NULL;' K  D7 u/ ^5 V7 Z6 L

  77. 6 {. l) |+ N5 n- U
  78. static int acnt = 512;. c& f  o  @8 [* c* ^& Y
  79. static int bcnt = 8;
    - T" J: R2 U, c4 D
  80. static int ccnt = 8;+ B; T/ x- S# b  b0 ~# B0 {' }" g
  81. $ E  g2 c* z0 ^9 g. Q2 ^. N. [
  82. module_param(acnt, int, S_IRUGO);
    + G2 v1 I+ R  T! K9 ^
  83. module_param(bcnt, int, S_IRUGO);% f9 Z2 [2 \* n( [! R$ D
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 h, x! Q9 A: d1 t  B( a
* ]4 T9 b9 ?8 }$ M3 a' `
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 ?# ?0 \: J' i% A, Y$ |$ T- farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( D6 @! S1 h( T  i7 P
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" g# C) R- y4 [9 o! R" d* `2 Z9 D

( i& Z& ]: J7 [! x: G( Q+ W; l
; j# N& ?" K/ ]1 l  p& I: \$ C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-15 02:13 , Processed in 0.058422 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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