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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 \5 F' }1 q, R* r
  1. [code]EDMA sample test application: C4 x. Q. G' j1 ~; l; N' ^- E
  2. /*
    9 E( H: K# {6 W
  3. * edma_test.c, S# ?2 u/ c( v
  4. *+ @" j  ~! A: n& p
  5. * brief  EDMA3 Test Application
    # z% O* J1 P. e' A
  6. *8 X# v+ F: A& @, Q6 [! |
  7. *   This file contains EDMA3 Test code.( H5 o, D6 L. h) E. R
  8. *
    ) h  a9 \/ D, m; N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + f7 b* E0 w) }7 T6 b7 q) {) B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; N6 `- L  Y7 W) V
  11. *         TO CHANGE.1 I7 j; h- r' i! n0 }, z
  12. *
    # f# s3 Z" M# u6 p1 N& W6 A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 ~1 }: y9 e% m
  14. *
    " A; H2 |3 [, T! b% a
  15. * This program is free software; you can redistribute it and/or
    : [8 t9 P  q& ?, C
  16. * modify it under the terms of the GNU General Public License as, N2 }$ w4 J5 s8 O. `. K1 U8 ~
  17. * published by the Free Software Foundation version 2.
    7 I; P! E  r: t  u- S
  18. *
    9 c4 J8 B3 k) I0 v" L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! n1 R$ ^5 M  A$ m
  20. * kind, whether express or implied; without even the implied warranty
    % j# W/ X' g0 a% t% @  X" p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ c9 ], ~& ?. Z& M  `1 R: E, V; j
  22. * GNU General Public License for more details.) d6 m. n9 |( s% N: G( _) }$ s4 x
  23. */9 e: U) ?' C/ `, N

  24. ) P1 n/ G+ l3 z6 f! o
  25. #include <linux/module.h>
    ! A, T% }9 E0 }* P. `" u/ Y
  26. #include <linux/init.h>
    ' o8 ~7 \2 P/ y( d. G& d5 H$ h
  27. #include <linux/errno.h>( h2 \8 H3 B  \3 i
  28. #include <linux/types.h># g8 `3 I/ S0 W# S. Z
  29. #include <linux/interrupt.h>2 L+ |" D# v) L& O; A
  30. #include <asm/io.h>1 e' `6 x! i+ ~- J! u" a
  31. #include <linux/moduleparam.h>: X4 J6 A0 T' J$ u# l  o
  32. #include <linux/sysctl.h>5 E7 z; {. U3 g6 r
  33. #include <linux/mm.h>
    ; Y( _3 j4 ?& M% I
  34. #include <linux/dma-mapping.h>4 L" O: t: q* ?/ |/ L

  35. + @1 }/ V4 x; H* \4 A
  36. #include <mach/memory.h>
    . `$ I& ?) d, ?5 V. r- X/ h# i
  37. #include <mach/hardware.h>7 L4 Z4 s+ m7 P# {! z" g
  38. #include <mach/irqs.h>$ r: Y' G, d$ c
  39. #include <asm/hardware/edma.h>
    0 {) @. Q/ p3 K

  40. 2 o7 m% i0 K: w, ^
  41. #undef EDMA3_DEBUG! K  p; u9 S& w0 O1 e& L1 ~0 t
  42. /*#define EDMA3_DEBUG*/
    / p5 h: b. U: ^3 r) K, l

  43. % f6 ~% d8 n; Z4 X5 R4 t
  44. #ifdef EDMA3_DEBUG$ _. K0 [% F# `1 C: R' o! ?7 R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 f* d9 e- L4 E" M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" W8 s) L6 B0 z; j% a$ B% {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 ]% C8 {# z; y9 [- y4 C4 N
  48. #else
    . W! ?1 b0 b' N* M# |
  49. #define DMA_PRINTK( x... )
    . _# x+ @0 l  S1 H4 [# A
  50. #define DMA_FN_IN
    # {0 J9 v2 V( t7 _
  51. #define DMA_FN_OUT
    : K1 E; z# S. K5 X
  52. #endif
    - w8 x: q: q3 Q+ q& {2 l( g2 J

  53. % H9 K$ S/ F. t. n* A+ |- l4 {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% A: g% M2 @5 g4 K/ x6 B; Y
  55. #define STATIC_SHIFT                3  @1 z' ~1 o9 ^
  56. #define TCINTEN_SHIFT               20( E5 f* }0 A0 _) d! Z/ X  y* E
  57. #define ITCINTEN_SHIFT              21% @/ X& @0 G" J
  58. #define TCCHEN_SHIFT                22  J( h2 u$ X; `* z8 Z7 b
  59. #define ITCCHEN_SHIFT               23( ]3 h! ]. h, B5 F: n' p) l1 ~
  60. 1 k5 g$ k& g" Z- e1 d; n
  61. static volatile int irqraised1 = 0;( R: g6 }" A% K
  62. static volatile int irqraised2 = 0;/ g3 S/ Z8 I1 v% p2 S- m) O
  63. $ R1 i7 A& ^% D7 _' {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# a! h$ t& W9 b# j" ]; v8 ]/ z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - w& b, y! L. ~8 ^7 c8 ^0 b2 L5 E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 a7 ~; f; P5 D4 e
  67. 9 b/ o8 ?2 V, T
  68. dma_addr_t dmaphyssrc1 = 0;
    & @+ J7 k0 }; h) Z+ _" J
  69. dma_addr_t dmaphyssrc2 = 0;
    0 H, e6 S* M" E1 m* U: g
  70. dma_addr_t dmaphysdest1 = 0;
    $ l' X: N3 P# E3 x
  71. dma_addr_t dmaphysdest2 = 0;: G; `8 S8 Q: D) g: ^5 H2 M
  72. & m. L* h5 G: [) H
  73. char *dmabufsrc1 = NULL;4 j! i/ L) B# r! M8 s
  74. char *dmabufsrc2 = NULL;/ J; E! b' G7 P/ ]# T
  75. char *dmabufdest1 = NULL;. e0 Q- W. }! ~- c* l
  76. char *dmabufdest2 = NULL;9 B2 y) ^3 B. r/ C

  77. " m% M. q4 j* ?/ F
  78. static int acnt = 512;
    $ k, f, z( i. N- N( @
  79. static int bcnt = 8;
    4 E8 _9 j6 [6 W
  80. static int ccnt = 8;
    7 w- c( B- \; {+ F

  81. + k3 T* d  ^7 S8 O
  82. module_param(acnt, int, S_IRUGO);0 m0 G. `. }: w+ ?) v8 L4 o
  83. module_param(bcnt, int, S_IRUGO);& r- l# \# s( R- s7 Y6 D
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  m1 @. V5 z5 Z  O, R' K3 [1 F
/ T/ z( `5 _( }% q) w+ s9 _- X- S      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) _/ J) C) H! |$ K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 J; c. ~, r+ z7 f4 a% G3 ^5 ^  O. @& K     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- Y6 f1 U6 r" F2 G# `  A3 C2 ~

0 Y4 ~& \- g# x7 p* N( m1 Q: r/ U  M0 W) j/ ^# J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-1 13:30 , Processed in 0.041761 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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